简体   繁体   English

SaltStack在Windows上执行未签名的Powershell脚本

[英]SaltStack executing unsigned powershell scripts on windows

Is there a way to pass switch operators to the powershell prompt that is created to execute scripts. 有没有一种方法可以将开关操作员传递到为执行脚本而创建的powershell提示符。 Essentially I have a state file which executes a powershell script: 本质上,我有一个执行powershell脚本的状态文件:

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 因为一种肮脏的解决方案是通过cmd运行脚本,所以:%windir%\\ System32 \\ WindowsPowerShell \\ v1.0 \\ powershell.exe -NonInteractive -executionpolicy绕过-File

Any way to set the executionpolicy flag in the state file itself? 有什么方法可以在状态文件本身中设置executionpolicy标志?

Thanks! 谢谢!

尝试使用file.managed来部署保存.exe的sls,然后使用and cmd.run而不是cmd.script来执行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM