Win32_product class issue

Neutrino

Gawd
Joined
Nov 10, 2005
Messages
602
Hi guys,

Has anyone here used the Win32_product class to list installed software from remote computers or used its methods like Uninstall() ?

It seems that Microsoft advises against using this class:
http://support.microsoft.com/kb/974524

Win32_product Class is not query optimized. Queries such as “select * from Win32_Product where (name like 'Sniffer%')” require WMI to use the MSI provider to enumerate all of the installed products and then parse the full list sequentially to handle the “where” clause. This process also initiates a consistency check of packages installed, verifying and repairing the install. With an account with only user privileges, as the user account may not have access to quite a few locations, may cause delay in application launch and an event 11708 stating an installation failure.

I found some alternatives here:

http://blogs.technet.com/b/heyscrip...shell-to-quickly-find-installed-software.aspx

problem with the alternatives:

1. Win32Reg_AddRemovePrograms is available only if the SMS/SCCM client is installed and get-member does not list any methods just properties so you could not initiate an uninstall

2. The registry query should run on any computer and it's fine if all you need is to list the software but then you run into the same problem: no methods to call upon :(

Anyway this is a heads up for anyone using this class.

Also do you guys have any ideas on an alternative to something like:

Code:
$a = get-wmiobject win32_product -computer yyyy | where-object {$_.name -like "*XXXX*"}
$a.Uninstall()


aside from a remote execution of the uninstall file with a silent switch of course :)

any .net objects ( that I can build in powershell) perhaps that have this function?
 
Last edited:
I've used the "select * from win32_product" statement on a couple apps, and it has been fine. Usually its been kicked off on a background thread to collect some information from the machine.

Edit: Alternatively, consider making an executable that is run on the client machine, and have it gather and submit the metrics from the client side.
 
Well I've used it a bit also and mostly it runs fine. Lots of people seem to be using it actually, so when I recently found that technet link advising against using it I was quite surprised and I figured it would be nice to give you guys a heads up

also as I said the biggest problem is not really collecting metrics, I already have alternatives for that (Win32Reg_AddRemovePrograms is much much faster actually if you have a environment with SMS/SCCM)

what would be nice is to find an alternative to the methods of win32_product, in particular i found useful the Uninstall() method
 
Last edited:
Back
Top