MS powershell Excution Policy no access to registry

When trying to set the execution policy of MS powershell to allow unsigned script usage you may get the following error:
“Set-ExecutionPolicy : Access to the registry key HKEY_LOCAL_MACHINESOFTWAREMicrosoftPowerShell1ShellIdsMicrosoft
.PowerShell’ is denied.”

This is because the group policy does not allow the local registry to be edited.

In this case using the “scope CurrentUser” can help.

Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser