阅读背景:

尝试启用powershell脚本的执行时,我一直收到此错误

来源:互联网 
Set-ExecutionPolicy : Access to the registry key     'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\
PowerShell
Set-ExecutionPolicy : Access to the registry key     'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\
PowerShell\1\ShellIds\Microsoft.PowerShell' is denied.
At line:1 char:20
+ Set-ExecutionPolicy <<<<  Unrestricted
+ CategoryInfo          : NotSpecified: (:) [Set-ExecutionPolicy], UnauthorizedAcce 
ssException
+ FullyQualifiedErrorId :    System.UnauthorizedAccessException,Microsoft.PowerShell.C 
ommands.SetExecutionPolicyCommand

Is there any way to bypass this? Or at least run my powershell code? Please help!

有没有办法绕过这个?或者至少运行我的powershell代码?请帮忙!

1 个解决方案

#1


you can do the following,

你可以做到以下几点,

PowerShell.exe -ExecutionPolicy Bypass -File .runme.ps1

and run this in a cmd prompt

并在cmd提示符下运行它

or copy and paste the whole script in a PS Console

或者将整个脚本复制并粘贴到PS控制台中


\ShellIds\Microsoft.PowerShell' is denied. At line:1 char:20 + Set-ExecutionPolicy <<<< Unrestricted + CategoryInfo : NotSpecified: (:) [Set-ExecutionPolicy], UnauthorizedAcce ssException + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.C ommands.SetExecutionPolicyCommand Set-ExecutionPolicy : Access to the registry ke



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: