无法为 CurrentUser 设置 Powershell ExecutionPolicy

Cam*_*ute 12 powershell windows-10

这是我正在运行的命令示例:

PS C:\> Get-ExecutionPolicy -List 

        Scope ExecutionPolicy
        ----- ---------------
MachinePolicy       Undefined
   UserPolicy       Undefined
      Process       Undefined
  CurrentUser       Undefined
 LocalMachine    Unrestricted


PS C:\> Set-ExecutionPolicy Unrestricted -Scope CurrentUser
PS C:\> Get-ExecutionPolicy -List

        Scope ExecutionPolicy
        ----- ---------------
MachinePolicy       Undefined
   UserPolicy       Undefined
      Process       Undefined
  CurrentUser       Undefined
 LocalMachine    Unrestricted
Run Code Online (Sandbox Code Playgroud)

我想将 设置CurrentUserUnrestricted,但我似乎无法这样做。我按照此 MSDN 文档中的概述检查了适当的组策略,但没有找到任何已配置的内容。

关于如何设置这个的任何线索?

ddc*_*ver 12

就像所有其他人所说的那样,这似乎是 Windows 10 预览版中的一个错误。我只需提供 -Force 参数即可使其工作。

本地机器的设置:

Set-ExecutionPolicy RemoteSigned -Force
Run Code Online (Sandbox Code Playgroud)

当前用户的设置:

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
Run Code Online (Sandbox Code Playgroud)


Cam*_*ute 5

这似乎是 Windows 10 中的一个错误。我必须创建密钥并在该密钥中创建一个用数据HKEY_CURRENT_USER\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell调用的字符串值,然后它才能工作。即使这样,我似乎也无法在不修改注册表的情况下更改它。ExecutionPolicyUnrestricted