每当我运行Powershell脚本时,都会出现错误:
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 Unrestricted. Type "Get-ExecutionPolicy -List" to view your execution policy settings. For more
information please see "Get-Help Set-ExecutionPolicy".
当我在Powershell ISE中运行脚本或在命令行中运行命令时,不会发生这种情况。 反正有阻止这种情况发生的方法吗?
答案 0 :(得分:0)
如错误消息中所写,您可以使用Get-ExecutionPolicy -List
检查所有策略。更详细的作用域级别将覆盖更一般的级别。
对于我来说,我是通过在流程级别上设置执行策略来解决的。
Set-Executionpolicy -ExecutionPolicy RemoteSigned -Scope Process