How do I detect which version of Internet Explorer is installed? - windows

Is the best way to look under the Uninstall key of the Windows Registry?
Is there a Microsoft API call which provides this info and is it supported from XP onwards?
What is the best way to detect which version of Internet Explorer is installed on the local machine?

You have to look in the registry, but not in uninstall key. Instead,
find the key at HKLM\Software\Microsoft\Internet Explorer and read the value named Version.
For newer versions (IE 10 and above), Version is 9.x (for example, IE 10 is 9.10.something), and the new svcVersion value gives the true IE version.
This technique is even recommended by Microsoft; see here.

If you require to know the IE version into a web application you can get the User-Agent or use javascript:
You got here a Microsoft sample of how to get the internet Explorer version
http://msdn.microsoft.com/en-us/library/ms537509(VS.85).aspx
If you require to detect the IE Version into a Desktop program with X language you need to read the Windows registry
This registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer contains the attribute Version with the IE version

The Version value doesn't seem to include the Internet Explorer version information that you would most likely need. Instead, look at either svcVersion or svcUpdateVersion for the information.
As an example, I am running IE 10 and if I query the Version registry value 9.10.9200.16798 is returned but if I query svcUpdateVersion 10.0.13 is returned. The latter corresponds to the actual Internet Explorer version which is 10.
REG QUERY "HKLM\Software\Microsoft\Internet Explorer" /v Version
HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer
Version REG_SZ 9.10.9200.16798
REG QUERY "HKLM\Software\Microsoft\Internet Explorer" /v svcUpdateVersion
HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer
svcUpdateVersion REG_SZ 10.0.13
REG QUERY "HKLM\Software\Microsoft\Internet Explorer" /v svcVersion
HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer
svcVersion REG_SZ 10.0.9200.16798

I'd like to challenge the conventional wisdom of inspecting the registry. Consider the reference source for System.Windows.Forms.WebView.Version:
string mshtmlPath =
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "mshtml.dll");
FileVersionInfofvi = FileVersionInfo.GetVersionInfo(mshtmlPath);
return new Version(
fvi.FileMajorPart, fvi.FileMinorPart, fvi.FileBuildPart, fvi.FilePrivatePart);
Presumably, the guys who wrote the WebView class knew what they were doing.

You can also know the IE version on multiple computers using this script:
#Echo off
Cls
MD C:\SYSADMIT > NUL
Echo. > c:\SYSADMIT\Resultados.txt
SET ListaEquipos=C:\SYSADMIT\ListaEquipos.txt
For /F "Tokens=*" %%z In (%ListaEquipos%) Do (
echo %%z >> c:\SYSADMIT\Resultados.txt
reg query "\\%%z\hklm\Software\Microsoft\Internet Explorer" /v svcVersion >> c:\SYSADMIT\Resultados.txt
)
Inside the file: ListaEquipos.txt, there is a list of computers.
It is also necessary to check RemoteRegistry service enabled on the target computers.
Extracted from: http://www.sysadmit.com/2017/08/windows-buscar-version-de-internet-explorer-en-equipo-remoto.html

Related

How to get Windows version number (e.g. 1903 or 1909) on the command line?

I want exactly the same output as winver only on the command line. For example, on my machine running winver returns this:
I need a command line alternative that would return 1909. I know how to get the 18363 piece - [environment]::OSVersion.Version.Build (in powershell). Googling reveals several options, none of which tell me that the version is 1909:
wmic os get
systeminfo
Now maybe they encode it differently, I do not know. Ideally I want to get the Version and the OS Build.
EDIT 1
I am OK to read it from registry, since it can be done on the command line.
EDIT 2
Thanks to a hint from dxiv I found it:
(get-itemproperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ReleaseId).ReleaseId
The "Version" number displayed in winver matches the ReleaseID value from the registry key HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion, and circumstantial evidence suggests that there is no API to retrieve it, other than reading it from the registry (per my previous answer here).
The following reads the version number from the registry into a Version environment variable at the cmd prompt (double the %%a, %%c percents when using in a batch file).
C:\etc>for /f "tokens=1-3" %a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ReleaseID') do #set "Version=%~c"
C:\etc>echo Version = '%Version%'
Version = '2004'

How to get chrome version using command prompt in windows

Is it possible to get version installed chrome version using command prompt in windows?
Tried,
"C:\Program Files\Google\Chrome\Application\chrome.exe" -version
"C:\Program Files\Google\Chrome\Application\chrome.exe" --version
"C:\Program Files\Google\Chrome\Application\chrome.exe" -product-version
"C:\Program Files\Google\Chrome\Application\chrome.exe" --product-version
When i do that, a browser instance is opening. What flag should I be using to get the version.
I am using Windows 7. Google Chrome version is 67.0.3396.87.
Thanks in advance
As of today user4851's is still working. I took a look at his linked bug report and the proposed work around did not work for me anymore.
Anways a new hkey is present in my directory which allows you to query the chrome version without being aware of the actual installation location:
reg query "HKEY_CURRENT_USER\Software\Google\Chrome\BLBeacon" /v version
There's a bug filed about this: https://bugs.chromium.org/p/chromium/issues/detail?id=158372
Original Answer (but see the update below)
What works for me is
wmic datafile where name="C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" get Version /value
It prints
Version=67.0.3396.99
surrounded by some blank lines.
There are some other suggestions in the bug comments, like querying the registry.
Update
Someone from the Chromium team posted this "totally unsupported" batch file in the bug comment thread:
#ECHO OFF
:: Look for machine-wide Chrome installs (stable, Beta, and Dev).
:: Get the name, running version (if an update is pending relaunch), and
:: installed version of each.
FOR %%A IN (
{8A69D345-D564-463c-AFF1-A69D9E530F96},
{8237E44A-0054-442C-B6B6-EA0509993955},
{401C381F-E0DE-4B85-8BD8-3F3F14FBDA57}) DO (
reg query HKLM\Software\Google\Update\Clients\%%A /v name /reg:32 2> NUL
reg query HKLM\Software\Google\Update\Clients\%%A /v opv /reg:32 2> NUL
reg query HKLM\Software\Google\Update\Clients\%%A /v pv /reg:32 2> NUL
)
:: Look for Chrome installs in the current user's %LOCALAPPDATA% directory
:: (stable, Beta, Dev, and canary).
:: Get the name, running version (if an update is pending relaunch), and
:: installed version of each.
FOR %%A IN (
{8A69D345-D564-463c-AFF1-A69D9E530F96},
{8237E44A-0054-442C-B6B6-EA0509993955},
{401C381F-E0DE-4B85-8BD8-3F3F14FBDA57},
{4ea16ac7-fd5a-47c3-875b-dbf4a2008c20}) DO (
reg query HKCU\Software\Google\Update\Clients\%%A /v name /reg:32 2> NUL
reg query HKCU\Software\Google\Update\Clients\%%A /v opv /reg:32 2> NUL
reg query HKCU\Software\Google\Update\Clients\%%A /v pv /reg:32 2> NUL
)
That should probably be seen as the right way to go for the time being.
I tried Kilian's answer, however in my case, I was running it against a bunch of machines remotely via a service, so I don't think HKEY_CURRENT_USER was valid:
ERROR: The system was unable to find the specified registry key or value.
Assuming you know where the exe is, you can try a different approach and read the version property of the exe file:
# Powershell
# Older versions install to the 32-bit directory
(Get-Item "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe").VersionInfo
# Newer versions use the 64-bit directory
(Get-Item "C:\Program Files\Google\Chrome\Application\chrome.exe").VersionInfo
ProductVersion FileVersion FileName
-------------- ----------- --------
76.0.3809.100 76.0.3809.100 C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
To using it in cmd.exe or via any subprocess calls (python, go os/exec, etc.) you can do,
powershell -command "&{(Get-Item 'Absolute\path\to\chrome.exe').VersionInfo.ProductVersion}"
Using only commandline utils
dir /B/AD "C:\Program Files (x86)\Google\Chrome\Application\"|findstr /R /C:"^[0-9].*\..*[0-9]$"
78.0.3904.97
List only directories /AD within the Chrome application folder in short form /B.
findstr /R /C:"..." applies the following regex to the list of directories. The regex matches every foldername starting with a digit ^[0-9] and ending with ad digit [0-9]$.
Between the first and last digit there are any characters .* allowed but at least one dot should appear \.
user1425134's solution worked for me, but if you are allowed to assume that Chrome is part of %PATH% (if you can open Command Prompt and type chrome to start the browser), then it can be greatly simplified.
From Powershell you can type (Get-Command "chrome").Version.ToString()
Or from cmd.exe you can type powershell -c "(Get-Command "chrome").Version.ToString()"
(same for Chromium, just replace the command name)
I was able to use the rust kitty's solution without having chrome on my path, as:
from PowerShell:
(Get-Command C:\Program Files (x86)\Google\Chrome\Application\chrome.exe').Version.ToString()
from cmd:
powershell -command "(Get-Command C:\Program Files (x86)\Google\Chrome\Application\chrome.exe').Version.ToString()"
Via Powershell the command is -
Get-WmiObject -Class Win32_Product | ? {$_.name -eq 'Google Chrome'} |select Name,Version

Changing Windows 7 Wallpaper Remotely

I am trying to remotely change the wallpaper on about 50 computers that are running Win 7 in a WORKGROUP environment.
I have local admin rights to all of them plus they are running an agent (Faronics) that lets me push .bat .exe .msi .vbs and .ps1 to them remotely.
Just wondering if there was any application that lets me do that remotely or if not, what is the easiest way to get my image to these machines and set it as default wallpaper?
The wallpaper that Windows uses is in the registry under the HKCU\Control Panel\Desktop\Wallpaper key
you just can change it with the REG command.
See REG /? and then try...
reg query "HKCU\Control Panel\Desktop" /v Wallpaper
and
reg add "HKCU\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d D:\my.bmp /f
Replacing the file in the following path C:\Users\[user name]\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper.jpg is hit or miss depending upon the other desktop background settings shown on the GUI and file type.
I have been able to successfully replace the file with another .jpg file renamed TranscodedWallpaper.jpg and put in its place but the Desktop doesn't just update by itself.
You have to force it with the Rundll32.exe user32.dll,UpdatePerUserSystemParameters command.
This is also hit or miss. I have had it work several times correctly while physically on the computer but cannot get the computer to do the same remotely.
Still working on a 100% working remote solution to fully answer the question.
You can use intelliadmin network administrator to change the desktop pictures remotely on all computers at once

VS2013RC requires IE10 but i need (not want) IE8

I've been evaluating the VS2013preview since its release and was keen to install the RC. The problem is we need ie8 for legacy testing as many customers out in the field still use it.
As a possible workaround would it be possible to either, skip or fool the install package into thinking its installed? or install ie10 and then drop back to ie8 after installation?
I appreciate there may be some areas of things like browserlink to ie that I cannot use but this is OK as I mostly use chrome for initial dev work prior to testing in the various browsers.
Credit goes to Jimmy here, but here's a hack to make it work:
#ECHO OFF
:IE10HACK
REG ADD "HKLM\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer" /v Version /t REG_SZ /d "9.10.9200.16384" /f
REG ADD "HKLM\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer" /v svcVersion /t REG_SZ /d "10.0.9200.16384" /f
REG ADD "HKLM\SOFTWARE\Microsoft\Internet Explorer" /v Version /t REG_SZ /d "9.10.9200.16384" /f
REG ADD "HKLM\SOFTWARE\Microsoft\Internet Explorer" /v svcVersion /t REG_SZ /d "10.0.9200.16384" /f
GOTO EXIT
:REVERTIE
REG DELETE "HKLM\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer" /v svcVersion
REG DELETE "HKLM\SOFTWARE\Microsoft\Internet Explorer" /v svcVersion
REG ADD "HKLM\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer" /v Version /t REG_SZ /d "8.0.7601.17514" /f
REG ADD "HKLM\SOFTWARE\Microsoft\Internet Explorer" /v Version /t REG_SZ /d "8.0.7601.17514" /f
GOTO EXIT
:EXIT
The problem is you're trying to use the same machine for developing and testing. Don't rely on the local copy of IE on your machine for testing a legacy browser, instead rely on virtual machine copies of Windows and run that specific browser.
If you want a quick & dirty way to test your stuff in specific versions of IE use the IETester as mentioned by others in the comments. http://my-debugbar.com/wiki/IETester/HomePage
You might want to consider simply using a virtual machine to run a copy of Windows with IE8 in it for your testing, since you don't really use it for day to day stuff anyways.
Microsoft announced yesterday that they are removing the requirement.
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/4153040-remove-the-requirment-for-internet-explorer-10-to-

Installing a .inf file using a windows batch file

When you right click on a .inf file you have an option to "Install". I want to install a .inf file from the command line using a batch file. What is the "right" way to do this?
Thanks!
[edit]
I should clarify that I am trying to run this on Windows XP (and not Vista). Though I appriciate (and up-voted) the below answer mentioning InfDefaultInstall.exe, I believe that program was not shipped with XP.
You can find the command when looking at the HKCR\inffile\shell\Install\command registry key. On Windows XP this is
%SystemRoot%\System32\rundll32.exe setupapi,InstallHinfSection DefaultInstall 132 %1
on Windows Vista and later this would be
%SystemRoot%\System32\InfDefaultInstall.exe "%1"
To use the batch file across several Windows versions you would need some trickery. You could use reg.exe to query for the key and try parsing the output (I didn't find a quick way of getting only the value from reg). If you know what platforms you're running on you could also hard-code the command lines and switch according to the Windows version (which would need another hack to find that out. %OS% doesn't tell you more than "Windows NT", unfortunately.).
rem tested/works
:inf
ver | findstr /il "Version 6." > nul
if %ERRORLEVEL%==0 goto :vista
:xp
start/wait rundll32.exe setupapi,InstallHinfSection DefaultInstall 4 %_%
goto :eof
:vista
%SystemRoot%\System32\InfDefaultInstall.exe "%_%"
:eof
Should works on any Windows system that has IE 4.0+:
RunDll32 advpack.dll,LaunchINFSection <file.inf>,DefaultInstall

Resources