How to find the UpgradeCode and ProductCode of an installed application in Windows 7
IMPORTANT: It's been a while since this answer was originally posted, and smart people came up with wiser answers. Check How can I find the Upgrade Code for an installed MSI file? from @ Stein Åsmul if you need a solid and comprehensive approach.
Here's another way (you don't need any tools):
- open system registry and search for
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
key (if it's a 32-bit installer on a 64-bit machine, it might be underHKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
instead). - the GUIDs listed under that key are the products installed on this machine
- find the one you're talking about - just step one by one until you see its name on the right pane
This GUID you stopped on is the ProductCode.
Now, if you're sure that reinstallation of this application will go fine, you can run the following command line:
msiexec /i {PRODUCT-CODE-GUID-HERE} REINSTALL=ALL REINSTALLMODE=omus /l*v log.txt
This will "repair" your application. Now look at the log file and search for "UpgradeCode". This value is dumped there.
NOTE: you should only do this if you are sure that reinstall flow is implemented correctly and this won't break your installed application.
It takes some time to return results, easily many tens of seconds, but wmic works well and can be scripted:
wmic product where "Name like '%Word%'" get Name, Version, IdentifyingNumber
result:
IdentifyingNumber Name Version
{90140000-001B-0409-0000-0000000FF1CE} Microsoft Office Word MUI (English) 2010 14.0.6029.1000
The IdentifingNumber
is the ProductCode. I didn't see a property for UpgradeCode, but perhaps it might be buried under something else. See http://quux.wiki.zoho.com/WMIC-Snippets.html for many other examples, including uninstall:
wmic path win32_product where "name = 'HP Software Update'" call Uninstall
To everyone using:
Get-WMIObject win32_product
You should be aware that this will run a self-heal on every single MSI application installed on the PC. If you were to check eventvwr it will say it has finished reconfiguring each product.
In this case i use the following (a mixture of Yan Sklyarenko's method):
$Reg = @( "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*", "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*" )
$InstalledApps = Get-ItemProperty $Reg -EA 0
$WantedApp = $InstalledApps | Where { $_.DisplayName -like "*<part of product>*" }
Now if you were to type:
$WantedApp.PSChildName
You would be given the following:
PS D:\SCCM> $WantedApp.PSChildName
{047904BA-C065-40D5-969A-C7D91CA93D62}
If your organization uses loads of MST's whilst installing applications you would want to avoid running self-heals encase they revert some crucial settings.
- Note - This will find your product code, then the upgrade can be found as Yan mentioned. I usually, though, just use either 'InstEd It!' or 'Orca' then go to the Property table of the MSI and it lists them right at the top.