johndeerb
asked on
Detect IE version from batch file or command script
I have a .cmd script built for an installer application, and I need to be able to detect what version of Internet Explorer is on the PC from within the script. I thought about using reg.exe to output the registry key to a temporary .txt file and then reading the file to find the version key. This seems klunky to me and I don't really like poking around in the users registry or creating files on their machines. Can anyone think of a cleaner way?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Your lightening fast, sir...
I am making a CD to send out for a simple task to build a connection to an unpublished IP web application. It will autorun a html file with links to steps in the connection, one of which is to install IE6 if needed. The app requires >= IE6, so I want to detect the version and if needed, launch the ie6 installer. The problem is that our folks don't want me to have anything on the page that requires the user to have their IE security set to allow scripting. SO, I thought if I just linked to a local .cmd script from the welcome page then it won't matter if their browsers allow scripting to run on the welcome page...
I am making a CD to send out for a simple task to build a connection to an unpublished IP web application. It will autorun a html file with links to steps in the connection, one of which is to install IE6 if needed. The app requires >= IE6, so I want to detect the version and if needed, launch the ie6 installer. The problem is that our folks don't want me to have anything on the page that requires the user to have their IE security set to allow scripting. SO, I thought if I just linked to a local .cmd script from the welcome page then it won't matter if their browsers allow scripting to run on the welcome page...
Hmm - I don't know that the scripting methods above will help you then...
What language are you using for the app?
What language are you using for the app?
ASKER
Does the user have to be a local admin to read from any key in the registry? HKEY_LOCAL_MACHINE\SOFTWAR E\Microsof t\Internet explorer for example...
(Sorry I am not a real registry guru...)
Thanks!
jb
(Sorry I am not a real registry guru...)
Thanks!
jb
HKLM - is the Local Machine - yes, the user would need admin access (85% sure of that...)
HKCU - no, this is the Current User key and the user typically has full rights to this hive.
You 'may' get read access to the hklm using reg.exe, but I doubt it...
I don't know much about your app or procedures here, but I wonder if you couldn't script something to automate that simple reg query under the local system credentials...just have System output the detail to a text file for you - maybe to the global %temp% path...
HKCU - no, this is the Current User key and the user typically has full rights to this hive.
You 'may' get read access to the hklm using reg.exe, but I doubt it...
I don't know much about your app or procedures here, but I wonder if you couldn't script something to automate that simple reg query under the local system credentials...just have System output the detail to a text file for you - maybe to the global %temp% path...
ASKER
The app is a canned solution from a vendor. My task is just to build a connection to get folks into it. I have redirected a couple of IP addresses on our firewall, so now I need to send a simple installer out to get folks up to requirements (IE6, java 1.4.2) and allow a connection(add 2 entries into hosts file). Since IE now blocks scripts from running on the page by default, I was afraid to use vbscript to handle the install because I don't want a bunch of phone calls from folks who don't notice the yellow bar.
Maybe I'll test tomorrow on some machines in house and verify whether a non-admin user can query the registry keys you mentioned. If that don't work, I guess it's vbscript and strict instructions, huh?
Thanks!!
jb
Maybe I'll test tomorrow on some machines in house and verify whether a non-admin user can query the registry keys you mentioned. If that don't work, I guess it's vbscript and strict instructions, huh?
Thanks!!
jb
Good luck to you... : ^)
ASKER
Looks like any user can query the HKLM keys using reg.exe but I'm having trouble getting the variable assignment to stick. I ran your code:
for /f "skip=2 tokens=3" %%a in ('reg query "hklm\software\microsoft\i nternet
explorer" /v Version') do set IEVer=%%a
in a command script followed by a line:
ECHO %IEVer%
and didn't get an echo. Am I missing something?
Thanks!
jb
for /f "skip=2 tokens=3" %%a in ('reg query "hklm\software\microsoft\i
explorer" /v Version') do set IEVer=%%a
in a command script followed by a line:
ECHO %IEVer%
and didn't get an echo. Am I missing something?
Thanks!
jb
If you run it from a command line, only use one % sign...
for /f "skip=2 tokens=3" %a in ('reg query "hklm\software\microsoft\i nternet
explorer" /v Version') do set IEVer=%a
for /f "skip=2 tokens=3" %a in ('reg query "hklm\software\microsoft\i
explorer" /v Version') do set IEVer=%a
ASKER
Never mind.. I'm an idiot.
I changed the code to:
for /f "skip=2 tokens=3" %%a in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWA RE\Microso ft\Interne t Explorer" /v Version') do set IEVer=%%a
ECHO Version is %IEVer%
and it is kind enough to echo the actual version number.
Thanks!!!
jb
I changed the code to:
for /f "skip=2 tokens=3" %%a in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWA
ECHO Version is %IEVer%
and it is kind enough to echo the actual version number.
Thanks!!!
jb
Glad to hear it :)
Though the HKLM should also work...
Though the HKLM should also work...
ASKER
Thanks again, sir...
I'd give you an A+ if there was one.
jb
I'd give you an A+ if there was one.
jb
Happy to help> :^)
Thanx for the grade!
Thanx for the grade!
Hi sir bounty ..Im working with IT security team so i need to login into all my server and need to take print screen of IE version details and SEP version details Windows update print screen ..is this possible to get this all the info by run batch file or script
Maybe cliinfo or systeminfo would provide you some of that detail. I suppose you could scrub the registry for anything omitted?
This will echo the version to the screen (2 lines).
Dim objFSO: Set objFSO = CreateObject("Scripting.Fi
wscript.echo objFSO.GetFileVersion("C:\
What do you need to do with the version data?
You can run a script based upon the version...
Dim objFSO: Set objFSO = CreateObject("Scripting.Fi
Dim objShell: Set objShell=CreateObject("Wsc
IEVersion=objFSO.GetFileVe
Select Case IEVersion
Case "6.0.2900.2180" 'IE6
objShell.Run "c:\ie6.bat"
Case Else 'not IE6
objShell.Run "c:\otherIE.bat"
End Select
Or, you can simply write it to a text file...
Dim objFSO: Set objFSO = CreateObject("Scripting.Fi
IEVersion=objFSO.GetFileVe
Dim objFile: Set objFile=objFSO.CreateTextF
objFile.WriteLine IEVersion
objFile.Close