Find Uninstall String in Registry with PowerShell

The PowerShell below will search the registry for a products uninstall string. The product is specified by user input shown below. This script will search the correct registry location for both 32-bit and 64-bit OS architecture.

<#	
	.NOTES
	===========================================================================
	 Created with: 	Windows PowerShell ISe
	 Created on:   	12/5/2017 20:15
     Changed on:    12/5/2017 21:35
	 Created by:   	Lex van der Horst
	 Filename:     	Find_Uninstall_String.ps1
	===========================================================================
	.DESCRIPTION
		PowerShell script to find the Uninstall strings in the registry
#>

$os = (Get-WmiObject Win32_OperatingSystem).OSArchitecture
$os32 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
$os64 = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
$readhost = Read-Host "Please enter a product name"

# 32-bit Operating System
If ($os -eq "32-bit")
{
    If (Get-ChildItem $os32 -Recurse |Get-ItemProperty | Where-Object {$_.DisplayName -like "*$readhost*"})
    {
    Get-ChildItem $os32 -Recurse |Get-ItemProperty | Where-Object {$_.DisplayName -like "*$readhost*"} |  Select-Object -Property DisplayName, DisplayVersion, UninstallString |Out-GridView -Title "Uninstall String"
    }
    Else{ Write-Host "No product found" -ForegroundColor Red }
}

# 64-bit Operating System
Else
{
    If (Get-ChildItem $os64 -Recurse |Get-ItemProperty | Where-Object {$_.DisplayName -like "*$readhost*"})
    {
    Get-ChildItem $os64 -Recurse |Get-ItemProperty | Where-Object {$_.DisplayName -like "*$readhost*"} |  Select-Object -Property DisplayName, DisplayVersion, UninstallString |Out-GridView -Title "Uninstall String"
    }
    Else { Write-Host "No product found" -ForegroundColor Red }
}

If one or more products are found, in this example adobe, you will be able to review the item(s) in a GridView.

Download: Find Uninstall String

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s