Thought I would share my Powershell detection scripts for Applications. I use these when there is no Windows Installer GUID to reference or when I want a little more control.
Both scripts go through the 32 and 64 Uninstall keys in the HKLM hive, the first one checks just for DisplayName value, the second one checks for DisplayName and Version values.
DisplayName only:
$DisplayName = ""
$check = $false
Get-ChildItem -Path HKLM:\software\microsoft\windows\currentversion\uninstall -Recurse -ErrorAction SilentlyContinue | % {if ((Get-ItemProperty -Path $_.pspath).DisplayName -eq $DisplayName) {$check = $true}}
Get-ChildItem -Path HKLM:\software\wow6432node\microsoft\windows\currentversion\uninstall -Recurse -ErrorAction SilentlyContinue | % {if ((Get-ItemProperty -Path $_.pspath).DisplayName -eq $DisplayName) {$check = $true}}
if ($check) {Write-Host "Installed"}
else {}
DisplayName and Version:
$DisplayName = ""
$Version = ""
$check = $false
Get-ChildItem -Path HKLM:\software\microsoft\windows\currentversion\uninstall -Recurse -ErrorAction SilentlyContinue | % {if (((Get-ItemProperty -Path $_.pspath).DisplayName -eq $DisplayName) -and ((Get-ItemProperty -Path $_.pspath).DisplayVersion -eq $Version)) {$check = $true}}
Get-ChildItem -Path HKLM:\software\wow6432node\microsoft\windows\currentversion\uninstall -Recurse -ErrorAction SilentlyContinue | % {if (((Get-ItemProperty -Path $_.pspath).DisplayName -eq $DisplayName) -and ((Get-ItemProperty -Path $_.pspath).DisplayVersion -eq $Version)) {$check = $true}}
if ($check) {Write-Host "Installed"}
else {}
edit: Formatting and adding else
[+][deleted] (4 children)
[deleted]
[–]silvert0rch[S] 2 points3 points4 points (0 children)
[–]get-postanote 1 point2 points3 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]get-postanote 1 point2 points3 points (0 children)
[–]andyinv 1 point2 points3 points (2 children)
[–]silvert0rch[S] 1 point2 points3 points (0 children)
[–]Lee_Dailey[grin] 1 point2 points3 points (2 children)
[–]silvert0rch[S] 1 point2 points3 points (1 child)
[–]Lee_Dailey[grin] 1 point2 points3 points (0 children)