Friday, January 21, 2011

How to set ExecutionPolicy: access to registry key denied

I'm running Windows Server 2008 as admin and I tried to set ExecutionPolicy as Remotesigned for PowerShell v2 like this:

Set-ExecutionPolicy RemoteSigned

But I got this error:

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 <<<<  RemoteSigned
    + CategoryInfo          : NotSpecified: (:) [Set-ExecutionPolicy], UnauthorizedAccessException
    + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.SetExecutionPolicyComma
   nd

How to fix this?

  • Right click on Powershell shortcut and choose 'Run as Administrator'

    Joey : Also note that if you have a 64-bit OS you need to set the execution policy for both the 32-bit and 64-bit version of PowerShell.
    atricapilla : Thanks very much!
    From

0 comments:

Post a Comment