Pages

Thursday, July 29, 2010

Fetch list software installed on software when WMIC fails

first try : WMIC > product list full /Format:csv /Output:c:\gt.csv 
if it does NOT works then and only then use :  

To fetch software installed  installed on any windows server (where WMIC does not works)
here is a VBScript that should output the same thing as product get name. Save it to a file GtPrdNames.vbs and execute it.

= = = = = = = = = = = = = = 
Option Explicit
Dim strComputerDim objWMIService, colProducts, objProductDim arrstrProducts(), i

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colProducts = objWMIService.ExecQuery("Select * From Win32_Product")

i = 0
For Each objProduct in colProducts
    ReDim Preserve arrStrProducts(i)
    arrStrProducts(i) = objProduct.Name
    i = i + 1
Next
WScript.Echo Join(arrStrProducts, vbNewLine)
 
= = = = = = = = = = = = = = 

Warning: This method has worked for me on windows 2000 & 2003 env, But could not guarantee for you. You may use is as is, Risk involved !

2 comments:

  1. Hi There! I am using Vista. Would that be fine? What are the risk it involves? I would be waiting for your response. Thanks for sharing. More power to you and to your site!

    bibliography software

    ReplyDelete
  2. I am not sure if it can work on Vista, You can try this.
    1. Go to run -> type Wbemtest
    2. Launch program
    3. click Connect
    4. Change value root\default to root\cimv2, then click Connect
    5. Click Quey
    6. Enter 'Select * from Win32_Product' and then click apply.
    This should work, if this work then you may try the script, if not then you may try to register the dll by comamnd 'regsvr32 wbemdisp.dll'.

    If it goes well, then it means WMIC is fine. But as said, I am not sure if it will work on Vista and about the risk involved.

    ReplyDelete