简体   繁体   English

Powershell:执行政策

[英]Powershell : Execution Policy

I have been running my code for past few months by doing this - 这样做我过去几个月一直在运行我的代码 -

Set-ExecutionPolicy Unrestricted

But, something weird is happening and I am getting this error always - 但是,一些奇怪的事情正在发生,我总是得到这个错误 -

Windows PowerShell updated your execution policy successfully, but the setting is overridden by a policy defined at a more specific scope. Windows PowerShell已成功更新您的执行策略,但该设置被更具体范围内定义的策略覆盖。 Due to the override, your shell will retain its current effective execution policy of "Unrestricted". 由于覆盖,您的shell将保留其当前有效的“Unrestricted”执行策略。 Type "Get-ExecutionPolicy -List" to view your execution policy settings. 键入“Get-ExecutionPolicy -List”以查看执行策略设置。 For more information, please see "Get-Help Set-ExecutionPolicy." 有关详细信息,请参阅“Get-Help Set-ExecutionPolicy”。

I have referred these links but no luck - 我已经提到这些链接但没有运气 -

Get-ExecutionPolicy -List Get-ExecutionPolicy -List

 MachinePolicy UserPolicy Process CurrentUser LocalMachine 

You should see output like this from Get-ExecutionPolicy -List : 你应该从Get-ExecutionPolicy -List看到这样的输出:

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

Once you see the scope that has the undesired setting, you can reset it like so: 一旦看到具有不需要的设置的范围,您可以像这样重置它:

Set-ExecutionPolicy Undefined -Scope <scope-name>

That is assuming you have permission to do so. 假设您有权这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM