I know I waited far too long to start working with PowerShell. But OK, here we are. And immediately encountered something. By default it sets some security related to running scripts. Only when I did what it said, I was unable to change that security!
OK in short, after you install PowerShell, it sets the “ExecutionPolicy” for scripts to “Restricted”, which means you’re not allowed to execute scripts. Not very interesting… So I used the “Set-ExecutionPolicy RemoteSigned” command to change, but this returned an error:
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 <<<< RemoteSigned
- Open registry
- Browse to key HKLM\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell
- If “ExecutionPolicy” does not exist, create it as REG_SZ with value “RemoteSigned”
- Open PowerShell and use the command “Get-ExecutionPolicy” to see it is done correctly
It’s only obvious that if another security level is desired, you adapt the value…