Query a remote computer registry key

Hello,

When you need to do something in PowerShell, there are a lot of way to do that, hereunder a way of querying a remote computer registry key :

$PSExecutionPolicy=[Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey("LocalMachine","Computer1")
$PSExecutionPolicyKey=$PSExecutionPolicy.OpenSubKey("SOFTWAREMicrosoftPowerShell1ShellIdsMicrosoft.PowerShell")
$PSExecutionPolicyKey.GetValue("ExecutionPolicy")

This example will retrieve the PowerShell execution policy of the computer “Computer1”.

Here the technical documentation of that class.