We had a client who wanted to clean out a Java uninstall that had gone badly. Java was still showing in APPS AND FEATURES (aka PROGRAMS AND FEATURES) but it had been uninstalled already.
We knew that the uninstall registry path was HKLM > SOFTWARE > Microsoft > Windows > CurrentVersion > Uninstall
but at that point there is a large list of GUID’s that the we did not want go open one by one to figure out which GUID related to Java.
We wrote this tidy little script to search the registry to find it for us:
# Define the registry paths
$uninstallPaths = @(
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall",
"HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
)
# Search for Java-related entries in both paths
foreach ($uninstallPath in $uninstallPaths) {
Get-ChildItem -Path $uninstallPath | ForEach-Object {
$displayName = $_.GetValue("DisplayName")
if ($displayName -like "*Java*") {
Write-Output "Found Java entry:"
Write-Output "Key: $($_.PSChildName)"
Write-Output "DisplayName: $displayName"
Write-Output "---------------------------------"
}
}
}
If you want to search for something other than Java, you can simply change the
if ($displayName -like "*Java*") {
from JAVA to any word you want.
If you want to search for 32 bit apps
We hope this helps you as it certainly helped us.
0 Comments