2011-05-26 51 views
9

我試圖在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機器上。

回答

27

您是否在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

相關問題