小编Kus*_*nki的帖子

运行任何 powershell 脚本时出现 Set-ExecutionPolicy 错误

我在运行任何 powershell 脚本时遇到以下错误。它仅发生在一台客户端服务器上。我不确定是什么触发了这个命令。

如果我将此注册表项从 RemoteSignedto 更改为 ByPass 错误就会消失。

Set-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\PowerShell -Name ExecutionPolicy -Value ByPass
Run Code Online (Sandbox Code Playgroud)

例如,我有下面一行简单的脚本。

Read-Host -Prompt "Hit Enter to exit"
Run Code Online (Sandbox Code Playgroud)
Set-ExecutionPolicy : Windows PowerShell updated your execution policy successfully, but the setting is overridden by
a policy defined at a more specific scope.  Due to the override, your shell will retain its current effective
execution policy of RemoteSigned. Type "Get-ExecutionPolicy -List" to view your execution policy settings. For more
information please see "Get-Help Set-ExecutionPolicy".
At line:1 char:46
+ …
Run Code Online (Sandbox Code Playgroud)

powershell

3
推荐指数
1
解决办法
9110
查看次数

标签 统计

powershell ×1