Use PowerShell to find application uninstall keys

Uninstalling applications from our systems is a common task that we all encounter from time to time. Sometimes, finding the right uninstallation information for an application can be a challenge. Fortunately, PowerShell comes to the rescue with its ability to search for application uninstall keys in the Windows registry.

The Windows registry holds crucial information about installed applications, including their uninstallation details. With a simple PowerShell script, we can effortlessly retrieve this information and make our uninstallation process much smoother.

Here’s a handy PowerShell script that helps us find application uninstall keys:

# Define the registry paths for uninstall information
$registryPaths = @(
“HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall”,
“HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall”,
“HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall”
)

# Loop through each registry path and retrieve the list of subkeys
foreach ($path in $registryPaths) {
$uninstallKeys = Get-ChildItem -Path $path -ErrorAction SilentlyContinue

# Skip if the registry path doesn’t exist
if (-not $uninstallKeys) {
continue
}

# Loop through each uninstall key and display the properties
foreach ($key in $uninstallKeys) {
$keyPath = Join-Path -Path $path -ChildPath $key.PSChildName

$displayName = (Get-ItemProperty -Path $keyPath -Name “DisplayName” -ErrorAction SilentlyContinue).DisplayName
$uninstallString = (Get-ItemProperty -Path $keyPath -Name “UninstallString” -ErrorAction SilentlyContinue).UninstallString
$version = (Get-ItemProperty -Path $keyPath -Name “DisplayVersion” -ErrorAction SilentlyContinue).DisplayVersion
$publisher = (Get-ItemProperty -Path $keyPath -Name “Publisher” -ErrorAction SilentlyContinue).Publisher
$installLocation = (Get-ItemProperty -Path $keyPath -Name “InstallLocation” -ErrorAction SilentlyContinue).InstallLocation

if ($displayName) {
Write-Host “DisplayName: $displayName”
Write-Host “UninstallString: $uninstallString”
Write-Host “Version: $version”
Write-Host “Publisher: $publisher”
Write-Host “InstallLocation: $installLocation”
Write-Host “—————————————————”
}
}
}

This script allows us to search for application uninstall keys in the Windows registry by utilizing the predefined registry paths where uninstall information is typically stored. It retrieves important properties such as the application name, uninstall command, version, publisher, and install location.

By running this script, we can easily gather the necessary information to uninstall applications cleanly and efficiently. It simplifies the process of locating uninstall keys and saves us from manually searching through the registry.

Leave a comment

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

8 − 2 =