Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rodrigoborgesdeoliveira/38b90087fd55a04fd97aeef6a2a1aea5 to your computer and use it in GitHub Desktop.
Save rodrigoborgesdeoliveira/38b90087fd55a04fd97aeef6a2a1aea5 to your computer and use it in GitHub Desktop.
Possible registry locations to find an installed program and get the product code from
  • HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
  • HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall
  • HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall
function Search-RegistryUninstallKey {
param($SearchFor,[switch]$Wow6432Node)
$results = @()
$keys = Get-ChildItem HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall |
foreach {
$obj = New-Object psobject
Add-Member -InputObject $obj -MemberType NoteProperty -Name GUID -Value $_.pschildname
Add-Member -InputObject $obj -MemberType NoteProperty -Name DisplayName -Value $_.GetValue("DisplayName")
Add-Member -InputObject $obj -MemberType NoteProperty -Name DisplayVersion -Value $_.GetValue("DisplayVersion")
if ($Wow6432Node)
{Add-Member -InputObject $obj -MemberType NoteProperty -Name Wow6432Node? -Value "No"}
$results += $obj
}
if ($Wow6432Node) {
$keys = Get-ChildItem HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall |
foreach {
$obj = New-Object psobject
Add-Member -InputObject $obj -MemberType NoteProperty -Name GUID -Value $_.pschildname
Add-Member -InputObject $obj -MemberType NoteProperty -Name DisplayName -Value $_.GetValue("DisplayName")
Add-Member -InputObject $obj -MemberType NoteProperty -Name DisplayVersion -Value $_.GetValue("DisplayVersion")
Add-Member -InputObject $obj -MemberType NoteProperty -Name Wow6432Node? -Value "Yes"
$results += $obj
}
}
$results | sort DisplayName | where {$_.DisplayName -match $SearchFor}
}
@rodrigoborgesdeoliveira
Copy link
Author

Source: https://smsagent.blog/2015/10/15/searching-the-registry-uninstall-key-with-powershell/

Usage: Paste Search-RegistryUninstallKey in powershell and run

Search-RegistryUninstallkey -SearchFor "<keyword>" -Wow6432Node

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment