Need to silently uninstall software via script or find a specific application's GUID? This PowerShell command queries the registry to list all installed applications, their display names, and their silent uninstall commands.
The Fix
Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall |
Get-ItemProperty |
Where-Object { $_.DisplayName -ne $null -and $_.SystemComponent -ne 1 -and $_.ParentKeyName -eq $null } |
Select-Object DisplayName, DisplayVersion, Publisher, InstallLocation, UninstallString |
Format-Table -AutoSize
Why it works
- This command enumerates the common registry locations where installed programs register their details. It filters out system components and updates to show only user-installed applications, along with their associated uninstall commands.
Verify
- The output will be a formatted table showing
DisplayName,DisplayVersion,Publisher,InstallLocation, and most importantly,UninstallStringfor each detected application.
Notes
- Requires Administrator privileges.
- The
UninstallStringcan often be modified for silent uninstallation (e.g., adding/qnor/sswitches), but this varies by application installer. - This method captures applications installed for all users. For per-user installations, also check
HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall.
Techworks Blog