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!

2
  • 1
    It looks like the current development branch (see 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. Commented Feb 5, 2014 at 19:28
  • Thanks Lee! I will try updating to the 2014.1.0 today Commented Feb 5, 2014 at 19:45

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.