通过VisualStudio运行Powershell ExecutionPolicy时出错

问题描述:

我试图在VS2005项目上运行PowerShell脚本作为我的预生成的一部分。我已经运行了通过VisualStudio运行Powershell ExecutionPolicy时出错

$> powershell Set-ExecutionPolicy UnRestricted 

从构建之前的命令行开始,我可以从命令行运行相同的脚本。然而,当脚本运行作为预生成步骤的一部分,它失败

The execution of scripts is disabled on this system. 
Please see “get-help about_signing” for more details. 

脚本工作的同事的X32 XP的计算机上,但不是我的Windows7的x64机器上。

您是否在64位和32位Powershell环境中都设置了执行策略?你的64位机器将有两个,并且每个都有自己的执行策略设置。

+0

是的,就是这样,谢谢。 – 2011-05-26 20:30:37

+5

64位将在64位机器上默认运行。要将其设置为32位,您需要运行C:\ Windows \ SysWOW64 \ WindowsPowerShell \ v1.0 \ powershell.exe(来源:http://kb.paessler.com/en/topic/20443-powershell-32bit -or-64-和执行政策) – 2014-08-06 10:55:08