Check if a Program Is Installed With PowerShell 3

<# Returns true if a program with the specified display name is installed. This function will check both the regular Uninstall location as well as the "Wow6432Node" location to ensure that both 32-bit and 64-bit locations are checked for software installations. @param String $program The name of the program to check for. @return Booleam Returns true if a program matching the specified name is installed. #> function Is-Installed( $program ) { $x86 = ((Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall") | Where-Object { $_.GetValue( "DisplayName" ) -like "*$program*" } ).Length -gt 0; $x64 = ((Get-ChildItem "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall") | Where-Object { $_.GetValue( "DisplayName" ) -like "*$program*" } ).Length -gt 0; return $x86 -or $x64; }
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.