当前位置:网站首页>PowerShell: because running scripts is prohibited on this system, the solution

PowerShell: because running scripts is prohibited on this system, the solution

2022-06-13 04:36:00 A boy looking forward to the future

The article is from whale :https://www.jingyua.com

Make it up by yourself PowerShell I suddenly encountered this problem during the script :

Unable to load file C:\Users\DH\Desktop\cs\rename.ps1, Because scripts are not allowed to run on this system . For more information , see also https:/go.microsoft.com/fwlink/?LinkID=135170 Medium about_Execution_Policies.

+ CategoryInfo : SecurityError: (:) [],ParentContainsErrorRecordException

+ FullyQualifiedErrorId : UnauthorizedAccess

Screenshot of the problem

After checking, it was found that it was started on the computer Windows PowerShell when , The execution strategy is likely to be Restricted( default setting ).

 Restricted Execution policy does not allow any scripts to run .  

AllSigned and RemoteSigned Execution strategies prevent Windows PowerShell Run a script without a digital signature .

  This topic explains how to run the selected unsigned script ( Even when the execution strategy is RemoteSigned Under the circumstances ), It also explains how to    The script is signed for your own use .

of Windows PowerShell Details of the execution policy , see also about_Execution_Policy.

Want to know Active execution policy on the computer , open PowerShell Then input  get-executionpolicy

Active execution strategy

Open as administrator PowerShell Input  set-executionpolicy remotesigned

choice Y Then the computer can execute the script file written by itself

原网站

版权声明
本文为[A boy looking forward to the future]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/164/202206130429190916.html