Hi there,
We're trying to use the Salt
function cmd.script to run Powershell scripts on a Windows box. The
scripts run just fine but they are not seeing the command line
arguments. We've done some sanity testing with Bash scripts on a Linux
box and with a Batch script on the same Windows box. Command line
arguments work fine for those.
Our research led us to what we
believe is the culprit. When cmd.script executes a script on Windows, it
uses the (obvious) default of cmd.exe to launch the script. When we
open a cmd.exe shell and try to run our Powershell script, we also fail
to pass the parameters to the script.
Here is our (very simple) Powershell script.
"""
Write-Host "I found some text! It's -> $args"
"""
When we run this in a cmd.exe shell:
c:\tmp>test.ps1 donkey
The expected output:
I found some text! It's -> Donkey
The actual output:
I found some text! It's ->
Is
there another method we should be using to pass parameters to
Powershell scripts or possibly a workaround? We have some time and a
need for this feature so, given some guidance on where to start, we may
be able to implement this if it's not there yet.
We are using version 0.15.1 of both the Master and the Minion.
Thanks much.
-Drew