Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Gather IE Version

Status
Not open for further replies.

cparralesl

Programmer
Jan 27, 2002
118
NI
Hi all:

I modified a Sript that I found in this forum to get an Inventory SW of my PC. I notice that It did not included the IE.

I need tknow how to obtain the IE version using my Script.

Here is my code:
Code:
'On Error Resume Next 

strComputer = "."

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

Set colSoftware = objWMIService.ExecQuery _
    ("SELECT * FROM Win32_Product")   

Set colItems = objWMIService.ExecQuery _
    ("Select * from Win32_ComputerSystem")
For Each objItem in colItems
    CSPCName = objItem.Name
    CSUSName = objItem.UserName
    CSDmName = objItem.Domain
    CSSysTyp = objItem.SystemType
Next


For Each objOS in GetObject( _
    "winmgmts:").InstancesOf ("Win32_OperatingSystem")

	OSCaption = objOS.Caption
	OSVersion = objOS.Version
	OSRegUser = objOS.RegisteredUser
	OSManufac = objOS.Manufacturer
	OSEncLevl = objOS.EncryptionLevel 
	OSOrganiz = objOS.Organization
Next

If colSoftware.Count > 0 Then

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objTextFile = objFSO.CreateTextFile( _
        "\\Kftnimngfnp01\Publico\SoftwareInventory\" & CSPCName & ".txt", True)

	objTextFile.WriteLine "Cumputer Name" & vbtab & _
	"User Logged" & vbtab & _
	"Domain" & vbtab & _
	"System Type" & vbtab & _
	"OS Caption"  & vbtab & _
	"OS Version"  & vbtab & _
	"OS Registered Userd"  & vbtab & _
	"OS Manufacturer"  & vbtab & _
	"OS Encryption Level " & vbtab & _
	"OS Organization "  & vbtab & _
	"SW Caption" & vbtab & _
	"SW Version" & vbtab & _
	"SW Install Date" & vbtab & _
	"SW Install Location" & vbtab & _
	"SW Vendor" & vbtab & _
	"SW Package Cache" & vbtab & _
	"SW Identifying Number"

    For Each objSoftware in colSoftware

	objTextFile.WriteLine CSPCName & vbtab & _
	CSUSName & vbtab & _
	CSDMName & vbtab & _
	CSSysTyp & vbtab & _
	OSCaption & vbtab & _
	OSVersion & vbtab & _
	OSRegUser & vbtab & _
	OSManufac & vbtab & _
	OSEncLevl & vbtab & _
	OSOrganiz & vbtab & _
	objSoftware.Caption & vbtab & _
        objSoftware.Version & vbtab & _
	objSoftware.InstallDate & vbtab & _
	objSoftware.InstallLocation  & vbtab & _
	objSoftware.Vendor & vbtab & _
	objSoftware.PackageCache & vbtab & _
	objSoftware.IdentifyingNumber

    Next

    objTextFile.Close

Else
    WScript.Echo "Cannot retrieve software from this computer."

End If


Thanks inadvance


Cesar Humberto Parrales
Application Support
 
Thanks tsuji!

the link is helpful. Just one more question. I run the code in windows 7 and come up an error message saying something about null information.

Again my thanks to you.

Best regards,

Cesar Humberto Parrales
Application Support
 
[1] That specific namespace used in the reference is a fairly rarely appeared in use so I figure it would be interesting to let know. As it has also pointed that that namespace is retired/taken out from vista!...

[2] One method of more general applicable is to query the exact file of iexplore.exe. (But then, this time it has another risk of it not being located at the common place!)

[2.1] This is how. (It uses the same namespace of root\cimv2, so I can use your objWMIService definition.)
[tt]
squery="select * from cim_datafile where path=""\\Program Files\\Internet Explorer\\"" and filename=""iexplore"" and extension=""exe"""
set col=objWMIService.execquery(squery)
for each obj in col
wscript.echo obj.version 'read and parse from this if only major version is needed
next
set col=nothing
[/tt]
 
Another way you can do it...
Code:
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
    strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Internet Explorer"
strValueName = "Version"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
Wscript.Echo "Installed IE Version: " & strValue
Wscript.Echo "Major IE Version: " & Left(strValue,1)

I hope that helps.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Guys,

I wanna thanks a lot for your responses. Each one have been useful, I solve the issue i had.

Regards,



Cesar Humberto Parrales
Application Support
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top