Listing 64-bit registry keys using a 32-bit process

I created a tool with PowerShell Studio but I had to create it as a 32-bit executable. But when you try to listing the 64-bit registry, you have to use this (working with Powershell V3 and up only) :


$AddRemoveBranch = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine,$ComputerName, [Microsoft.Win32.RegistryView]::Registry64)
$AddRemoveKey = $reg.OpenSubKey($AddRemoveBranch)
$AddRemoveKey.GetSubKeyNames() | ForEach-Object {write-host "Application : $_"}

Leave a Reply