In order to query the list of installed programs on computers, you will often find resources on internet pointing

to the Wmi class Product.

.

Even though this class seems to just query the Msi repository to get you the results you are looking for, it will effectively start a Msi repair to get the result. If for whatever reason a package source is missing you will get an error message.

You can find more information about this issue here:

https://support.microsoft.com/en-us/kb/974524

http://csi-windows.com/toolkit/win32product-replacement

You can use the vbs script from Darwin Savoy or change your script to use Win32reg_addRemovePrograms as recommended by Microsoft.

.

If you use SCCM, you have another option, which is to use the spécific Sms_InstalledSoftware Class (see below).

.

get-wmiobject -Namespace ‘root\cimv2\sms’ -Class Sms_InstalledSoftware | Where {$_.ProductName -match “Java”} | |%{$_.ProductName}

.

wmic /namespace:’\\root\cimv2\sms’ Path Sms_INstalledSoftware where “ProductName like ‘%Java%'” get ProductName

I just wonder how many people are still using this class as of today and why Microsoft did not fix this behaviour yet…

 

Advertisements