I need to find out the powershell (versions 4 and 5+) execution policy without using powershell itself
I tried to look into registry - HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell
I found ExecutionPolicy value in two keys, HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell and HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\ScriptedDiagnostics
The first one corresponded to the policy given by executing Get-ExecutionPolicy cmdlet, but on some servers in our environment the value is missing. Is there any other, 100% reliable, way to check the policy without using Powershell itself?
HKLM\software\Wow6432Node\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell\ExecutionPolicy- gravity