參考引用
https://www.cnblogs.com/shanyou/archive/2011/09/03/2165371.html
問題說明
執行PowerShell腳本時提示
無法加載文件 D:\Workshop\Powershell\Sprinkler\src\Scripts\SPRINKLE.ps1,因爲在此係統-中禁止執行腳本。
+ D:\XXX\XX.ps1 <<<<
+ CategoryInfo : NotSpecified: (:) [], PSSecurityException
+ FullyQualifiedErrorId : RuntimeException
解決辦法
- 以管理員身份打開PowerShell
- 輸入Set-ExecutionPolicy RemoteSigned,執行策略更改
執行策略可以防止您執行不信任的腳本。更改執行策略可能會使您面臨 about_Execution_Policies
幫助主題中所述的安全風險。是否要更改執行策略?
[Y] 是(Y) [N] 否(N) [S] 掛起(S) [?] 幫助 (默認值爲“Y”): y
PS C:\Windows\system32>