Finding browser versions via VBScript or WMI

Print Friendly, PDF & Email

Pre Windows Vista, you could find the version of Internet Explorer via WMI using the following method:

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & _
    "\root\cimv2\Applications\MicrosoftIE")
 
Set colIESettings = objWMIService.ExecQuery _
    ("Select * from MicrosoftIE_Summary")
 
For Each strIESetting in colIESettings
    Wscript.Echo "Version: " & strIESetting.Version
    Wscript.Echo "Product ID: " & strIESetting.ProductID
    Wscript.Echo "Cipher strength: " & strIESetting.CipherStrength
Next

The MicrosoftIE_Summary object does not exist post Windows XP though (Why Microsoft, why?), so to find your browser versions, you could use the following VB Script, which essentially just checks the file version for you.

'Find the Firefox version (64 Bit machines with 32-bit Firefox installed)
Set objFSO = CreateObject("Scripting.FileSystemObject")
file = "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
Wscript.Echo objFSO.GetFileVersion(file)
 
'Find the Firefox version (Normal 32-bit machine)
Set objFSO = CreateObject("Scripting.FileSystemObject")
file = "C:\Program Files\Mozilla Firefox\firefox.exe"
Wscript.Echo objFSO.GetFileVersion(file)
 
'IE Version
file = "C:\Program Files\Internet Explorer\iexplore.exe"
Wscript.Echo objFSO.GetFileVersion(file)

Irrespective of whether you are running XP, Vista, 7 or even a Server variety of Windows, I would recommend the latter way of doing it though. You will probably have to build in some checks to see which browsers are installed before checking their versions. I see a lot of ‘if’ and ‘else if’s’ coming here 🙂

Enjoy!

2 comments

  1. Try this for All OS

    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 “IE Version: ” & Left(strValue,1)

    1. At the command prompt:
      wmic datafile where “Name=’%SYSTEMDRIVE%\\program files\\internet explorer\\iexplore.exe'” GET Version

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.