Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
427 views
in Technique[技术] by (71.8m points)

powershell - PowerShell说“此系统上的脚本执行被禁用。”(PowerShell says “execution of scripts is disabled on this system.”)

I am trying to run a file that calls a script from cmd.exe , and I am getting the below error:

(我正在尝试运行一个从cmd.exe调用脚本的文件,并且出现以下错误:)

Management_Install.ps1 cannot be loaded because the execution of scripts is disabled on this system.

(无法加载Management_Install.ps1因为在此系统上禁用了脚本的执行。)

I have run

(我跑了)

Set-ExecutionPolicy -ExecutionPolicy Unrestricted

and when I run Get-ExecutionPolicy from , I get Unrestricted back.

(当我从运行Get-ExecutionPolicy时,我得到了Unrestricted 。)

PS C:UsersAdministrator> Get-ExecutionPolicy
Unrestricted

C:ProjectsMicrosoft.Practices.ESBSourceSamplesManagement PortalInstallScripts> powershell .Management_Install.ps1 1

WARNING: Running x86 PowerShell...

File C:\Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\Install\Scripts\Management_Install.ps1 cannot be loaded because the execution of scripts is disabled on this system.

(无法加载文件C:\Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\Install\Scripts\Management_Install.ps1因为此系统上禁用了脚本的执行。)

Please see " get-help about_signing " for more details.

(请参阅“ get-help about_signing ”以获取更多详细信息。)

At line:1 char:25

(在线:1字符:25)

  • .\Management_Install.ps1 <<<< 1

    (.\Management_Install.ps1 <<<< 1)

    • CategoryInfo : NotSpecified: (:) [], PSSecurityException

      (CategoryInfo:未指定:(:) [],PSSecurityException)

    • FullyQualifiedErrorId : RuntimeException

      (FullyQualifiedErrorId:RuntimeException)

C:ProjectsMicrosoft.Practices.ESBSourceSamplesManagement PortalInstallScripts> PAUSE

Press any key to continue . . .

The system is Windows Server 2008R2.

(系统是Windows Server 2008R2。)

What am I doing wrong?

(我究竟做错了什么?)

  ask by Conor translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If you're using Windows Server 2008 R2 then there is an x64 and x86 version of PowerShell both of which have to have their execution policies set.

(如果您使用的是Windows Server 2008 R2,则必须安装x64x86版本的PowerShell,这两个版本都必须设置其执行策略。)

Did you set the execution policy on both hosts?

(您是否在两台主机上都设置了执行策略?)

As an Administrator , you can set the execution policy by typing this into your PowerShell window:

(作为管理员 ,您可以通过在PowerShell窗口中键入以下内容来设置执行策略:)

Set-ExecutionPolicy RemoteSigned

For more information, see Using the Set-ExecutionPolicy Cmdlet .

(有关更多信息,请参见使用Set-ExecutionPolicy Cmdlet 。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...