Windows 7: New Properties in Win32_Product Print E-mail
General
Written by Darwin Sanoy   
Monday, April 11, 2011 2:54pm

Although these new properties were available as of Vista, you may not be aware of them due to skipping Vista.

UPDATE: I was reminded by a reader that the Win32_Product class should be avoided in scripting whenever possible.  Please read about why, how to test it and some code to get the same information without using Win32_Product herehttp://csi-windows.com/toolkit/288-win32product-wmi-class-replacement

There are two main ways in a VBScript to check on properties of installed software.  One is the "Products" method of the WindowsInstaller.Installer object and the other is the Win32_Product WMI class.

Advantages of WMI Class Over WindowsInstaller.Installer Object

The WMI Class aggregates data that would take several different lines of code to retrieve from the WindowsInstaller.Installer object.  The sample code and tools available for retrieving data from WMI classes is also very easy to find versus working directly with the WindowsInstaller.Installer object.  WMI is significantly slower than the native object, but if end users are not waiting on the script to compete the time difference is not significant.

Check out our class Windows 7 Packaging Engineer (ENG-51) to learn about all the new Windows Installer features and behaviors since XP.

The WMIC alias "Product" appears to be unchanged, so you'll need to do VBScript or PowerShell to gain access to these new attributes.

Most Useful New Properties

AssignmentType - tells whether the package is installed for the user ("0") or the machine ("1").
InstallSource - folder where the MSI was run from.
PackageName - the original .MSI file name that was installed.
PackageCode - from the .MSI summary information stream. 
LocalPackage - the name of the .MSI in the local cache (appears to duplicate info in older PackageCache)
ProductID - better name for what was previously a generic "IdentifyingNumber" 
Transforms - list of transforms originally installed with the package. 

Additional New Properties 

HelpLink
HelpTelephone
Language
RegCompany
RegOwner
URLInfoAbout
URLUpdateInfo
WordCount

The attached script download contains a vbscript to list the new properties so you can easily integrate any of these attributes into your scripts. 



 

Attachments:
Download this file (win32_product_win7.zip)win32_product_win7.zip[ ]1 Kb
 

Add comment


Security code
Refresh