Need help with PowerShell and Parameters in User Defined Tool
Posted: Fri Aug 09, 2019 4:13 pm
Hello,
In ToDoList I have defined a User Defined Tool that calls a PowerShell script:
This works perfectly, the PowerShell script is executed by the User Defined Tool.
Now I wanted to add a parameter (ToDoList should send the title of the selected task as parameter to the PowerShell Script).
For the beginning I started with a static text for testing the parameters.
So I added in ToDoList the following text at the end of the Arguments (the first character is a blank):
In my PowerShell Script I added at the beginning:
When I now test the user defined tool, PowerShell is opening and closing at once (it is not working).
When I remove the parameter "OLLI" again, the the PowerShell is opening and displaying some text (it is working).
I also tried adding the following text at the end of the Arguments (first character is a blank):
But this is also not working.
The strange thing is: when I run the script within a PowerShell console then it works.
Here both of the following ways to add parameters are working:
In both calls the PowerShell is opening and displaying some text.
Am I doing something wrong?
Or is this a problem with ToDoList?
Best regards
OLLI
In ToDoList I have defined a User Defined Tool that calls a PowerShell script:
Code: Select all
Path : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Arguments : -noexit -File "C:\MyPath\SendMail_Defizitbewertung.ps1
Now I wanted to add a parameter (ToDoList should send the title of the selected task as parameter to the PowerShell Script).
For the beginning I started with a static text for testing the parameters.
So I added in ToDoList the following text at the end of the Arguments (the first character is a blank):
Code: Select all
"OLLI"
Code: Select all
param (
[String]$ParamAnwendung
)
Write-host "String Parameter: $ParamAnwendung"
pause
When I remove the parameter "OLLI" again, the the PowerShell is opening and displaying some text (it is working).
I also tried adding the following text at the end of the Arguments (first character is a blank):
Code: Select all
-ParamAnwendung "OLLI"
The strange thing is: when I run the script within a PowerShell console then it works.
Here both of the following ways to add parameters are working:
Code: Select all
C:\MyPath\SendMail_Defizitbewertung.ps1 "OLLI"
C:\MyPath\SendMail_Defizitbewertung.ps1 -ParamAnwendung "OLLI"
Am I doing something wrong?
Or is this a problem with ToDoList?
Best regards
OLLI