How to set ExecutionPolicy: access to registry key denied

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


Stephen Jennings in reply to the same question on StackOverflow:

Set-ExecutionPolicy Unrestricted -Scope CurrentUser

This will set the execution policy for the current user (stored in HKEY_CURRENT_USER) rather than the local machine (HKEY_LOCAL_MACHINE).


In case "Run as Administrator" doesn't work for you(didn't for me at first) or if you want a permanent solution, I found a fix by adding the permissions directly to the windows registry. After doing this when I called get-ExecutionPolicy it no longer came back restricted.

It's the equivalent of set-ExecutionPolicy RemoteSigned, with it actually working.

Wrote about it here: http://kyleclegg.com/powershell/

Hope this helps.