使用Win7-32bit和Powershell ISE,我尝试运行一个刚刚保存的脚本(假设包含一个简单的cls)。我得到一个错误,通常的“获取帮助about_signing”建议禁止执行脚本。
当使用“ set-executionpolicy remotesigned”解决时,我得到了一个对话框来验证我是否确定。但是,如果我接受另一个错误:
acces to registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell" denied
+ set-executionpolicy <<<< remotesigned
+ CategoryInfo : NotSpecified: (:) [Set-ExecutionPolicy], UnauthorizedAccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand
我该怎么做才能以用户身份(或作为日常服务自动运行)运行保存的脚本?
您需要以管理员身份运行powershell来设置执行策略。
一旦将其设置为remotesigned,就可以以普通用户身份运行powershell。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句