Sometimes we may required to find installed applications product and upgrade code for maintenance purpose or any other reason. In this post, I am going to share powershell script to get product id and upgrade code of installed tool.
Find Product Code
The below command lists all the installed software’s name and product code
1
|
get-wmiobject Win32_Product | Select-Object @{ n= 'Name' ; e={ $_ .Name}}, @{n= 'ProductCode' ; e={ $_ .IdentifyingNumber}} |
If you know the product name, you can just run the below command to get product code for a specific application.
1
2
3
|
$productName = “Name of your product” $info = get-wmiobject Win32_Product | Where-Object { $_ .Name –eq $productName } $productCode = $info . IdentifyingNumber |
In latest powershell (Windows 10 and later), we can use the command Get-Package to retrieve installed applications.
1
|
Get-Package | Select-Object @{ n= 'Name' ; e={ $_ .Name}}, @{n= 'ProductCode' ; e={ $_ .Metadata[ "ProductCode" ]}} |
Find Upgrade Code
Once you find product code from above script, you can easily find upgrade code by using product code. Replace your product code in below script and run the commands to get upgrade code.
1
|
gwmi -Query "SELECT Value FROM Win32_Property WHERE Property='UpgradeCode' AND ProductCode='{your product code}'" | Format-Table Value |
To know more details about Product Identification codes, we would recommend to refer the below post by Advanced Installer.
Advertisement