VMware:此计算机的PowerShell执行策略未设置为RemoteSigned

时间:2020-02-23 14:45:16  来源:igfitidea点击:

在Windows工作站上启动VMware vSphere PowerCLI时,您可能会收到以下消息:

The PowerShell execution policy of this computer is not set to "RemoteSigned";. This prevents execution of PowerShell scripts on your computer and will result in errors when VMware vSphere PowerCLI is invoked. It is recommended that you set the execution policy to "RemoteSigned"; in order to be able to execute scripts. This can be done by invoking the command 'Set-ExecutionPolicy RemoteSigned' from a PowerShell prompt.

正如消息本身告诉您的那样,您只需要打开PowerShell命令提示符:

Start > All Programs > Accessories > Windows PowerShell

并输入以下命令:

Set-ExecutionPolicy RemoteSigned

(然后按Y键接受更改)

如果要查看ExecutionPolicy的当前设置,只需执行以下操作:

Get-ExecutionPolicy

这是关于可能选择的一些解释:

Restricted  Scripts won’t run.
RemoteSigned  Scripts created locally will run, but those downloaded from the Internet will not (unless they are digitally signed by a trusted publisher).
AllSigned  Scripts will run only if they have been signed by a trusted publisher.
Unrestricted  Scripts will run regardless of where they have come from and whether they are signed.

要设置其中任何一个,只需执行以下操作:

Set-ExecutionPolicy <policy_name>