Reading Registry Remotely (Part 1)

by Aug 20, 2018

If you cannot use PowerShell remoting, and you need to read registry values from another system via DCOM, here is some example code you might want to try:

$ComputerName = 'pc01'
# NOTE: RemoteRegistry Service needs to run on a target system!
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $ComputerName)
$key = $reg.OpenSubKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall)

$key.GetSubKeyNames() | ForEach-Object {
    $subkey = $key.OpenSubKey($_)
            Name = $subkey.GetValue(DisplayName)
            Version = $subkey.GetValue(DisplayVersion)


With just some very small changes, the same code yields a list of AD use

This code sample requires:

  • That you have local Admin privileges on the target machine
  • That the RemoteRegistry service runs on the target machine
  • That the local firewall on the target has the “Remote Administrator Exception” enabled

Twitter This Tip! ReTweet this Tip!