Reputation: 16056
In PowerShell I have:
$ie = New-Object -COM InternetExplorer.Application
How to get the version number of $ie
? I want to verify that we are using an instance of IE11 or later, or prompt the user to upgrade their Internet Explorer.
Thanks!
Answer: Building on the accepted answer this is what I used:
$ieVersion = New-Object -TypeName System.Version -ArgumentList (
Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Internet Explorer').Version
$ieVersion = New-Object -TypeName System.Version -ArgumentList (
# switch major and minor
$ieVersion.Minor, $ieVersion.Major, $ieVersion.Build, $ieVersion.Revision)
if ($ieVersion.Major -lt 11)
{
Write-Error "Internet Explorer 11 or later required. Current IE version is $ieVersion"
exit
}
Upvotes: 1
Views: 18623
Reputation: 47573
Without instantiating an InternetExplore.Application
object one could use PowerShell to retrieve the version of IE from the registry. All versions of IE store their version in the same place. This should work:
(Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Internet Explorer').Version
In order to make sense of the Internet Explorer version numbers Microsoft provides a table. In particular IE11 is:
Internet Explorer 11 will have a version number that starts with 11 (for example, 11.0.9600). The version number will change based on the updates that have been installed for Internet Explorer. To see the version number and the most recent update installed, go to the Help menu and select About Internet Explorer.
Special Note: For IE 10+:
The version number returned by Version
will appear as <version minor>.<version major>...
. The true version that gets displayed is now stored in SvcVersion. One could create a Powershell Script that queries SvcVersion
(instead of Version
) and if it returns non blank use it. Otherwise one should query Version
as above.
Upvotes: 8