Using regedit to view and set the PowerShell execution policy remotely
If you're looking to find out how Windows determines the execution for PowerShell the following maybe helpful.
This can be set to one of the following values and you can set this value remotely using regedit.
It makes sense where possible to use the Group Policy template to modify the PowerShell execution settings
There are a couple of caveats to take into account when reading the setting remotely
If this sounds a bit tiresome why not check out the latest version of our Windows and Network Audit Tool, XIA Configuration Server which will do all of the detection for you.
Regardless of the version of PowerShell the following
registry key is used.
HKLM\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell
ExecutionPolicy REG_SZ
- Restricted
- AllSigned
- RemoteSigned
- Unrestricted
- Bypass
- Undefined
However if Group Policy (either through the local Group Policy editor or using Active Directory) is used the following setting
override this.
HKLM\SOFTWARE\Policies\Microsoft\Windows\PowerShell
ExecutionPolicy REG_SZ
It makes sense where possible to use the Group Policy template to modify the PowerShell execution settings
There are a couple of caveats to take into account when reading the setting remotely
- If the Group Policy key exists and is set to a
valid value then this is used
- If the Group Policy key exists but is set to an
invalid value then Restricted is
used (the local machine setting is ignored).
- If the Group Policy key exists but the value is
empty the Group Policy setting is ignored and the local setting used.
- If the registry key does not exist or is set to an unknown value then Restricted is used.
If this sounds a bit tiresome why not check out the latest version of our Windows and Network Audit Tool, XIA Configuration Server which will do all of the detection for you.
Why not follow us on Twitter? @centrelsolution
ReplyDeletehttps://twitter.com/centrelsolution