【发布时间】:2010-11-10 18:56:36
【问题描述】:
我正在尝试使用将调用 Powershell 的外部程序在 Windows Server 2008 上运行简单的 Powershell 脚本(例如,仅使用 dir 命令)
powershell.exe "& 'C:\Temp\myscript.ps1'"
我已设置(以管理员身份运行)执行策略不受限制。毕竟,我从客户端收到此错误
99: File C:\Temp\myscript.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please
see "get-help about_signing" for more detai ls. At line:1 char:2 + & <<<< 'C:\Temp\myscript.ps1' + CategoryInfo
: NotSpecified: (:) [], PSSecurityException + FullyQualifiedErrorId : RuntimeException
为什么我会收到此错误?无限制的执行策略还不够吗?
【问题讨论】:
-
问题已解决:Windows Server 2008 中有两个 Powershell,x64 和 x86。我必须在他们两个中设置不受限制的执行策略。
标签: powershell windows-server-2008