PowerShell Set-ExecutionPolicy Giving error

If you ever get this error the whole time, do not stress.

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

It’s okay, I too have had this issue and I am embarrassed enough to tell you that the reason is that you did not run PowerShell as Administrator when trying to change something that requires Admin access.

Now let’s all take a breath and try again, this time as Administrator.. There we go.

Adrian

0 views0 comments

Recent Posts

See All

invoke-command and enable-psremoting -force

Today seems to be PowerShell issue day and it was such a nice day until I had to remote into a new machine. I tried running invoke-command -computer $server {get-process | where-object {$_.Name -like