PowerShell/WMI: An alternative to using Win32_Product

Today I wanted to find the MSI uninstall string for a specific install of Adobe Reader on a remote computer. Seeing as using Win32_Product in WMI queries to look for installed software is not a good idea, and even Microsoft warn against using it, I needed to find an alternative.

This one is fairly long-winded, but it gets the job done. It will search both the 32-bit and 64-bit Uninstall keys in the registry.

"","Wow6432Node" | ForEach-Object {Get-ChildItem HKLM:\SOFTWARE\$_\Microsoft\Windows\CurrentVersion\Uninstall\ | ? {($_.GetValue("DisplayName")) -like "*Adobe*"}}

If you have any suggestions or alternatives, please feel free to post them in the comments.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s