Reading Installed Software (Part 1)

by Dec 18, 2020

The Get-ItemProperty cmdlet can read registry values in a much more powerful way than most users know. The cmdlet supports multiple registry paths, and it supports wildcards. This way, it takes only a one-liner to read all installed software (plus their uninstall strings) from four registry keys:

# list of registry locations where installed software is stored
$paths = 
# all users x64
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*', 
# all users x86
'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*', 
# current user x64
'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*', 
# current user x86
'HKCU:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'

Get-ItemProperty -ErrorAction Ignore -Path $paths |
    # eliminate all entries with empty DisplayName
    Where-Object DisplayName |
    # select some properties (registry values)
    Select-Object -Property DisplayName, DisplayVersion, UninstallString, QuietUninstallString


Twitter This Tip! ReTweet this Tip!