Link to home
Start Free TrialLog in
Avatar of jamesbcox1980
jamesbcox1980

asked on

VBScript to get IE version of all computers on the network.

I'm on a server with network administrator privileges, and I need to query each computer on the network to find out which version of Internet Explorer each has.

I need to return the results in a Scripting.Dictionary object in the format of the code below.

The problem with the code below is that the query only seems return version information of my own workstation, and doesn't seem to recognize others.  It could be that it only works with the XP version of WMI, as I'm the only one out of the computers that I'm querying that has XP.
Function LDNetworkIEv
    Set LDNetworkIEv = CreateObject("Scripting.Dictionary")

    '...code to query the computers on the network
    'through WMI goes here- fills the records variable **NtwkCmptrs** with
    'the results as:
    '
    'Computer Name
    'LD-CWillis
    'LD-JBrown
    'etc...


    For Each Cmptr in NtwkCmptrs
        strComputer = Cmptr

        Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2\Applications\MicrosoftIE")

        Set colSoftware = objWMIService.ExecQuery("Select * from MicrosoftIE_Summary")
        For Each objItem in colSoftware
            LDNetworkIEv(Cmptr) = objItem.Version
        Next
    Next
End Function

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jamesbcox1980
jamesbcox1980

ASKER

I tried the code, but I keep getting an Object required error, and I haven't been able to figure out why.  Says it's on line 9.  This method seems a little but outside of the boundaries of what I'd like to do anyway, as I prefer not to create files.

This script just needs to return the list in a scripting dictionary from the function.There's bound to be a way to query WMI on Windows 7 for this...  If I can do that, I can get the list of computers from the LDAP server no problem.
Ok, I found the reason why your script wasn't working for me.  Online 8 the initialization of the object objOutput, the variable name was misspelled, missing a "t", so it was "objOuput.  That was very hard to see!  I make that mistake way too often, and it kills me when I find the missing letter.

Anyway, like I said, I'd still like to either query WMI, or query the computer some other way, but at this point, I think I can scavenge the query part and plug it into my function to get it working.
Line 8, "Set objOuput =" should be "Set objOutput ="  (missing a "t"). Just in case anyone copies this script.  But it works great, thanks.
Hi, thanks for the grade.  If you don't want to use the computers.txt file, you can easily query the LDAP computer objects, and run against those...and instead of writing to the CSV you can write the computer name and version to a dictionary object.

Rob.
I was actually able to do so pretty easily right after I accepted your solution. It's up and running now. I've created a function that, when requested, queries LDAP, then queries each pc and stores the results in a database. It takes about 45 seconds to run, so we update when necessary.

Thanks again.