关于powershell的执行策略

参考https://learn.microsoft.com/zh-cn/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.6
有一堆策略
allsigned
bypass
default
remotesigned
restricted
unrestricted
undefined

默认是undefined,那么这时候用户系统就会采取restricted策略,会禁止运行脚本,服务器系统会采用remotesigned策略

通过Get-ExecutionPolicy -List的命令可以显示所有的执行策略
image
然后通过Set-ExecutionPolicy -ExecutionPolicy bypass命令可以把执行策略全部设置成bypass
这样就没有阻止了
需要管理员权限运行

posted @ 2026-03-27 11:44  sakrain  阅读(16)  评论(0)    收藏  举报