Windows 7: New Properties in Win32_Product |
![]() |
![]() |
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 here: http://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 ObjectThe 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 PropertiesAssignmentType - tells whether the package is installed for the user ("0") or the machine ("1"). Additional New PropertiesHelpLink The attached script download contains a vbscript to list the new properties so you can easily integrate any of these attributes into your scripts. |