atr*_*lla 23 powershell windows-server-2008
我正在以管理员身份运行 Windows Server 2008,我尝试将 ExecutionPolicy 设置为 PowerShell v2 的 Remotesigned,如下所示:
Set-ExecutionPolicy RemoteSigned
Run Code Online (Sandbox Code Playgroud)
但我收到了这个错误:
Set-ExecutionPolicy : Access to the registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft
.PowerShell' is denied.
At line:1 char:20
+ Set-ExecutionPolicy <<<< RemoteSigned
+ CategoryInfo : NotSpecified: (:) [Set-ExecutionPolicy], UnauthorizedAccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.SetExecutionPolicyComma
nd
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题?
小智 24
右键单击 Powershell 快捷方式并选择“以管理员身份运行”
小智 15
Stephen Jennings 在StackOverflow 上回答了同样的问题:
Set-ExecutionPolicy Unrestricted -Scope CurrentUser
Run Code Online (Sandbox Code Playgroud)
这将为当前用户(存储在 HKEY_CURRENT_USER 中)而不是本地机器(HKEY_LOCAL_MACHINE)设置执行策略。
| 归档时间: |
|
| 查看次数: |
78590 次 |
| 最近记录: |