1、输入 get-ExecutionPolicy 查看状态(Restricted 表示禁用)
get-ExecutionPolicy
2、输入set-ExecutionPolicy RemoteSigned
set-ExecutionPolicy RemoteSigned
报错
:set-ExecutionPolicy : 对注册表项“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell”的访问被拒绝
2.1 解决方法;输入 Set-ExecutionPolicy -Scope CurrentUser
Set-ExecutionPolicy -Scope CurrentUser
2.3 出现ExecutionPolicy:, 填入RemoteSigned
3、然后执行get-ExecutionPolicy,发现变成了RemoteSigned,就成功了