Command line 使用WiX安装Powershell脚本

Command line 使用WiX安装Powershell脚本,command-line,powershell,wix,windows-installer,Command Line,Powershell,Wix,Windows Installer,我有一个签名的PowerShell脚本,我想通过WiX安装程序将其部署到目标机器上。是否可以授予脚本执行权限 问候,, 福基 编辑- 似乎我必须使用命令集ExecutionPolicy RemoteSigned调用Powershell,但我无法让它工作。我看到Powershell命令窗口正在打开,但它不会更改策略 .. ... 如果您使用的是PowerShell 2.0,则PowerShell.exe上有一个-ExecutionPolicy参数。在一个自定义操作中尝试类似的操作以运行脚本

我有一个签名的PowerShell脚本,我想通过WiX安装程序将其部署到目标机器上。是否可以授予脚本执行权限

问候,, 福基

  • 编辑-
    似乎我必须使用命令集ExecutionPolicy RemoteSigned调用Powershell,但我无法让它工作。我看到Powershell命令窗口正在打开,但它不会更改策略

..
...

如果您使用的是PowerShell 2.0,则PowerShell.exe上有一个-ExecutionPolicy参数。在一个自定义操作中尝试类似的操作以运行脚本

ExeCommand="-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -File <scrptpath>"
execomand=“-NoLogo-NoProfile-ExecutionPolicy RemoteSigned-File”

我将通过组策略设置执行策略。

组策略是更好的方法


我认为您对PowerShell.exe的调用没有更改执行策略的原因是,cmdlet设置为在更改执行策略之前提示用户。-Force参数将在没有额外提示的情况下强制进行更改。

似乎我必须使用--Command Set ExecutionPolicy RemoteSigned调用Powershell,但我无法使其工作。您在目标计算机上使用Powershell 1.0还是2.0?我们赢了7个-因此我认为是2.0个。您有一个输入错误-应该是“RemoteSigned”
ExeCommand="-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -File <scrptpath>"