Powershell中禁止执行脚本解决办法
开始使用Powershell,导入管理模块或者其他操作的时候会出现因为在此系统中禁止执行脚本的报错,报错内容如下:
Windows PowerShell
版权所有 (C) 2009 Microsoft Corporation。保留所有权利。
PS C:\Windows\system32> C:\Users\shinelon\Documents\WindowsPowerShell\profile.ps1
无法加载文件 D:\Workshop\Powershell\Sprinkler\src\Scripts\SPRINKLE.ps1,因为在此系统中禁止执行脚本。有关详细信息,请参
阅 "get-help about_signing"。
所在位置 行:1 字符: 58
+C:\Users\shinelon\Documents\WindowsPowerShell\profile.ps1 <<<<
+ CategoryInfo : NotSpecified: (:) [], PSSecurityException
+ FullyQualifiedErrorId : RuntimeException
获取当前会话的执行策略:
PS C:\Windows\system32> get-ExecutionPolicy
Restricted
设定执行政策:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
总体流程:
也可以参考Microsoft官网:点击