0

Is there a way to pass switch operators to the powershell prompt that is created to execute scripts. Essentially I have a state file which executes a powershell script:

function1:
  cmd.script:
    - source: salt://utils/scripts/function1.ps1
    - shell: "powershell"
    - env: "-ExecutionPolicy bypass"

But this doesn't work.

Because a dirty solution is to run the script via cmd: %windir%\System32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -executionpolicy Bypass -File

Any way to set the executionpolicy flag in the state file itself?

Thanks!

balwa
  • 126
  • 1
  • 3
  • 1
    It looks like the current development branch (see https://github.com/saltstack/salt/blob/develop/salt/modules/cmdmod.py) sets the `-ExecutionPolicy bypass` option when running powershell scripts, so you could try using that. – Lee Feb 05 '14 at 19:28
  • Thanks Lee! I will try updating to the 2014.1.0 today – balwa Feb 05 '14 at 19:45

1 Answers1

1

try using a file.managed to deploy the sls that holds the .exe and then use and cmd.run instead of cmd.script for the execution

py_newbie
  • 30
  • 1
  • 5