Fix “Access to the registry key is denied” When Using PowerShell Scripts

Sometimes when you try to execute a script in PowerShell, you get the error “Access to the registry key is denied”. The error occurs when you try to run a command without Admin privileges. The actual error reads something like:

Set-ExecutionPolicy : Access to the registry key
‘HKEY_LOCAL_MACHINE\SOFTWARE\ Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell’ is denied.
At line:1 char:1

Use Admin Privilege

  • Log into the computer with an account that has administrator rights.
  • Also, right-click on “Windows PowerShell” and select “Run as administrator”.
  • Lastly, once you complete the above, execute the same command to change the execution policy.

Add Comment