I am working on a new package to upgrade one of the applications. This time, it requires I uninstall the old app first before installing the new version. There are two different versions, so I needed to retrieve the uninstall strings for both. That is when I decided to write this script that will scan the registry for the application and list the key values as shown below. It scans both the x86 and x64 Uninstall registry entries. The script was also written to be able to scan for wildcard values if there is more than one entry you are looking for.
You can download the script from my GitHub.
<#
.SYNOPSIS
Uninstall Finder
.DESCRIPTION
This script will retrieve the x86 and x64 uninstall registry key(s) for a specific applicaton. This is very helpful for Configuration Manager admins when needing to create packages, especially uninstall packages.
.PARAMETER ApplicationName
Name of the application as it appears in Add/Remove Programs
.PARAMETER Like
Select this if using a partial name or wanting multiple listings to appear
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2022 v5.8.209
Created on: 8/3/2022 11:44 AM
Created by: Mick Pletcher
Filename: FindRegistryUninstall.ps1
===========================================================================
#>
[CmdletBinding()]
param
(
[ValidateNotNullOrEmpty()]
[string]$ApplicationName,
[switch]$Like
)
If ($Like.IsPresent) {
Get-ChildItem -Path REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Where-Object { $_.DisplayName -like ('*' + $ApplicationName + '*') }
} else {
Get-ChildItem -Path REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Where-Object { $_.DisplayName -eq $ApplicationName }
}
0 comments:
Post a Comment