跳转到内容

Powershell无法运行脚本

来自FC
FC留言 | 贡献2024年1月29日 (一) 20:40的版本 (创建页面,内容为“<syntaxhighlight lang="powershell"> C:\脚本文件\wiki服务器备份.ps1 : File C:\脚本文件\wiki服务器备份.ps1 cannot be loaded because running scripts is disabled on this system. For more informati on, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170. At line:1 char:1 + C:\脚本文件\wiki服务器备份.ps1 + ~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : SecurityError: (:) [], PSSecurityException  …”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
C:\脚本文件\wiki服务器备份.ps1 : File C:\脚本文件\wiki服务器备份.ps1 cannot be loaded because running scripts is disabled on this system. For more informati

on, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.

At line:1 char:1

+ C:\脚本文件\wiki服务器备份.ps1

+ ~~~~~~~~~~~~~~~~~~~~~

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

    + FullyQualifiedErrorId : UnauthorizedAccess

PS C:\Users\Administrator> get-executionpolicy

Restricted

PS C:\Users\Administrator> set-executionpolicy remotesigned

Execution Policy Change

The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose you to the security risks described in

the about_Execution_Policies help topic at https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?

[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): y

PS C:\Users\Administrator> get-executionpolicy

RemoteSigned

解释一下

第一句是运行一个脚本发现无法运行

第二句为查看当前车略

第三句改变当前策略

第四句再次查看