Skip to content

Instantly share code, notes, and snippets.

@deekayen
Created October 9, 2023 17:46
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 deekayen/708ba3f8bff965d8099291dcb7f42401 to your computer and use it in GitHub Desktop.
Save deekayen/708ba3f8bff965d8099291dcb7f42401 to your computer and use it in GitHub Desktop.
Get list of all the GUIDs for uninstalling microsoft applications on Windows.
# https://4sysops.com/archives/find-the-product-guid-of-installed-software-with-powershell/
$UninstallKeys = "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall", "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
$null = New-PSDrive -Name HKU -PSProvider Registry -Root Registry::HKEY_USERS
$UninstallKeys += Get-ChildItem HKU: -ErrorAction SilentlyContinue | Where-Object { $_.Name -match 'S-\d-\d+-(\d+-){1,14}\d+$' } | ForEach-Object { "HKU:\$($_.PSChildName)\Software\Microsoft\Windows\CurrentVersion\Uninstall" }
foreach ($UninstallKey in $UninstallKeys) {
Get-ChildItem -Path $UninstallKey -ErrorAction SilentlyContinue | Where {$_.PSChildName -match '^{[A-Z0-9]{8}-([A-Z0-9]{4}-){3}[A-Z0-9]{12}}$'} | Select-Object @{n='GUID';e={$_.PSChildName}}, @{n='Name'; e={$_.GetValue('DisplayName')}}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment