Having issues with using parameters in the Powershell pugin. I get the same results if I do a full function in the script panel as my quick little example. Can you let me know what I am doing wrong?
if I setup a param input and try to use the optional parameters, it is getting appended to the command line and breaking somewhere along the way. I've tested this against multiple client machines with the same results.
I made a quick example of what I am seeing.
Here is the output in the console window:
Sending script to agent .....
Script CMD = @powershell -NoProfile -ExecutionPolicy unrestricted -file "%windir%\temp\myPSScript.ps1 -identity administrator"
Executing Script ....Processing -File 'C:\Windows\temp\myPSScript.ps1 -identity administrator' failed because the file does not have a '.ps1' extension. Specify a valid Windows PowerShell script file name, and then try again.
Issue passing parameters
Issue passing parameters
- Attachments
-
- 2019-01-22_12-53-10, LTClient.png (8.47 KiB) Viewed 18838 times
Re: Issue passing parameters
What version are you on?
Current version is 2.2.6
I believe we fixed that bug already. Looking at my current code base, that command is now generated as such.
"MyFile" is now quoted but the optional prams are outside the quotes which should fix the error your seeing.
Let me know if this is on version or not.
Current version is 2.2.6
I believe we fixed that bug already. Looking at my current code base, that command is now generated as such.
Code: Select all
CMD = String.Format("@powershell -NoProfile -ExecutionPolicy unrestricted -file ""{0}"" {1}", myFile, OptPrams)
"MyFile" is now quoted but the optional prams are outside the quotes which should fix the error your seeing.
Let me know if this is on version or not.
Re: Issue passing parameters
We are running 2.2.4, I'll check 2.2.6 and post an update if needed. Thank you.
Re: Issue passing parameters
Works like a charm.
There should probably be some information for formatting the optional parameters field. I noticed if I pass an argument encapsulated in single quotes, that the text is getting sent double encapsulated in single quotes and thus fails. Not really a problem but a a best practice I generally encapsulate my input to the parameter
Note that there is a spelling error in the run page.
There should probably be some information for formatting the optional parameters field. I noticed if I pass an argument encapsulated in single quotes, that the text is getting sent double encapsulated in single quotes and thus fails. Not really a problem but a a best practice I generally encapsulate my input to the parameter
Note that there is a spelling error in the run page.
- Attachments
-
- 2019-02-01_09-45-07, LTClient.png (1.04 KiB) Viewed 18758 times
Re: Issue passing parameters
Awesome sauce!