locked
Got an error: 0x80041001 when running VBScript to enumerate software RRS feed

  • Question

  • When I ran a VBScript on a windows8.1 machine, I got the following error. Same code ran successfully on other machines.

    Error: 0x80041001

    Code: 80041001

    Source: (null)

    The error line is 'For each ...'

    Code:

    Set MSIapps = GetObject("winmgmts:{impersonationLevel=impersonate}!\" & Computer & "\root\cimv2").ExecQuery("select * from Win32_Product where Name like 'Cisco%'")

    'enumerate the names of the packages in the collection

    For each App in MSIapps

            version =  App.Version
            installDIR = App.InstallLocation

    Next

    Thanks for your help.


    DQ


    • Edited by David_Qin Tuesday, March 31, 2015 9:55 PM
    • Moved by Bill_Stewart Monday, May 18, 2015 7:09 PM Abandoned
    Tuesday, March 31, 2015 9:53 PM

Answers

  • If you have Windows 8.1, then you can use PowerShell to test:


    get-wmiobject Win32_Product -filter "Name LIKE 'Cisco%'"
    

    If that fails, then you have a corrupt WMI instance and not a scripting question.


    -- Bill Stewart [Bill_Stewart]


    • Edited by Bill_Stewart Friday, April 17, 2015 9:30 PM Forgot WMI class
    • Proposed as answer by Bill_Stewart Saturday, April 18, 2015 7:56 PM
    • Marked as answer by Bill_Stewart Monday, May 18, 2015 7:09 PM
    Wednesday, April 1, 2015 2:16 PM

All replies

  • Sorry but the code, as posted,wold never work anywhere because it is missing pieces.

    Try this:

    Set MSIApps = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & computer & "\root\cimv2").ExecQuery("select * from Win32_Product where Name like 'Cisco%'")

    For each App in MSIApps
    Next


    ¯\_(ツ)_/¯

    Tuesday, March 31, 2015 11:04 PM
  • Thanks for the reply. I only got the error on one machine, others work fine. 

    DQ

    Tuesday, March 31, 2015 11:30 PM
  • If you have Windows 8.1, then you can use PowerShell to test:


    get-wmiobject Win32_Product -filter "Name LIKE 'Cisco%'"
    

    If that fails, then you have a corrupt WMI instance and not a scripting question.


    -- Bill Stewart [Bill_Stewart]


    • Edited by Bill_Stewart Friday, April 17, 2015 9:30 PM Forgot WMI class
    • Proposed as answer by Bill_Stewart Saturday, April 18, 2015 7:56 PM
    • Marked as answer by Bill_Stewart Monday, May 18, 2015 7:09 PM
    Wednesday, April 1, 2015 2:16 PM