I have an application installed on my machine. I also have its source code but somehow the ProductCode and UpgradeCode of this application were changed.
Now I want t
Powershell handles tasks like this fairly handily:
$productCode = (gwmi win32_product | `
? { $_.Name -Like "*" } | `
% { $_.IdentifyingNumber } | `
Select-Object -First 1)
You can then use it to get the uninstall information as well:
$wow = ""
$is32BitInstaller = $True # or $False
if($is32BitInstaller -and [System.Environment]::Is64BitOperatingSystem)
{
$wow = "\Wow6432Node"
}
$regPath = "HKEY_LOCAL_MACHINE\SOFTWARE$wow\Microsoft\Windows\CurrentVersion\Uninstall"
dir "HKLM:\SOFTWARE$wow\Microsoft\Windows\CurrentVersion\Uninstall" | `
? { $_.Name -Like "$regPath\$productCode" }