set-ExecutionPolicy RemoteSigned

set-ExecutionPolicy RemoteSigned 是什么意思?有没有知道的大佬呢?

阅读 5.3k
1 个回答

参考 set-executionpolicy

Set-ExecutionPolicy 是一个 Powershell 的 cmd-let ,用途是设定 powershell 脚本的安全策略。即决定什么 .ps 脚本可以被运行,什么脚本不允许运行。详细介绍看上面的参考文档。

RemoteSigned. Requires that all scripts and configuration files downloaded from the Internet are signed by a trusted publisher. The default execution policy for Windows server computers.

RemoteSigned 参数要求所有网络下载的脚本和配置文件必须有可信发布者的签名(和HTTPS或Windows自带的签名机制类似),这也是 Windows Powershell 默认的策略。

未经过签名的脚本在 RemoteSigned 策略下运行会产生这样的结果

PS> .\Start-ActivityTracker.ps1

.\Start-ActivityTracker.ps1 : File .\Start-ActivityTracker.ps1 cannot be loaded.
The file .\Start-ActivityTracker.ps1 is not digitally signed.
The script will not execute on the system.
For more information, see about_Execution_Policies at
At line:1 char:1
+ .\Start-ActivityTracker.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进