Check if a Program Is Installed Using PowerShell 3

Note: This article was originally written on reich-consulting.net. Reich Web Consulting has narrowed its focus to the web and no longer offers tech support services, so we’ve moved all of our tech support content off-site. We hope you find this article useful. It is provided as-is, and we will no longer provide support on this topic.

When I write scripts to automate the deployment of software, I always prefer to check to see if a program is already installed rather than run the install and see if it fails. One way to do this is to use Get-WmiObject to query the WMI_Product table. This is certainly the most direct way but it’s slow and Microsoft recommends against it, as it forces the Windows Installer service to check the validity of all installed MSI’s and can actually cause problems.

Microsoft’s solution is to query the HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall registry key to check for installed software. The code at the link I provided works, but since PowerShell provides direct access to the registry with Get-ChildItem there’s a far easier way to do it:

[rc_codebin snippet_id=”5221" ]

Update: I noticed that the original version of the code was not returning true for 64-bit software that I knew to be installed. I updated the function to check the “Wow6432Node” in the registry as well.

Reich Web Consulting

Written by

Purveyor of fine web creations. Former tech support geniuses. Occasional spouter of opinions on topics of politics and ethics.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade