When trying to set the execution policy of scripts using the Set-ExecutionPolicy PowerShell cmdlet, you get this error:
Access to the registry key ‘HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell’ is denied.
To fix this, you need to find the icon to launch PowerShell (from the start menu), right click it and click Run as administrator. Running Set-ExecutionPolicy will then run the command as a user with access to write to the registry key and will no longer error with access denied.