I’m trying to do more of these “QuickPost” articles as I work on some big ones. This particular post was going to be part of the ongoing investigation I’ve been doing into the roaming behaviour of Internet Explorer’s Cookies and History, but seeing as though that is dragging into a third week (and I always make a point of taking Saturdays off!), I’ve decided to quickly blog this part up to keep articles ticking over.
One thing I’ve found in my breakdown of all things Internet Explorer, from versions 8 to 11, is that Microsoft love to change things between versions. A lot. I’m not going to get into how much of a pain this is for people like us who have to roam settings between vast arrays of different devices and form factors (but it is!!!) What I found useful, though, during this time of pain and testing, was the ability to tell what version of Internet Explorer was installed on a particular machine, so I could then tailor the Actions in Environment Manager to the installed version. Obviously, if you don’t use DesktopNow, this method of determining the version may prove useful too.
This doesn’t account for machines that may have different browser versions layered or streamed into the base operating system – this deals specifically with the version of Internet Explorer that the OS “believes” is installed because it is what is in the base image.
To determine the Internet Explorer version, we are just going to use a Custom PowerShell Action to set a Machine environment variable. Nice and simple. We will check for the version in the Startup trigger, so the variable will be set each time the system boots.
The odd bit about this is that the Registry value that holds the Internet Explorer version changes from version 9 to version 10. In IE9 or lower, the value is called Version. In IE10 or higher, it’s called SvcVersion. Weird.
Easiest way around this is an If Else Group. If the svcVersion Registry value exists, pull the version from it. If it doesn’t exist, pull it from Version instead. If you downgrade your IE, this may not work, but for most situations it should be fine.
The PowerShell we will use is this (lines will probably have wrapped). Edit the value of Version/svcVersion as necessary (there’s a config for download at the end if you prefer to use that – or there used to be, until DropBox deleted half my files, thanks DropBox)
$ieVersion = New-Object -TypeName System.Version -ArgumentList (Get-ItemProperty ‘HKLM:\SOFTWARE\Microsoft\Internet Explorer’).svcVersion/Version
$ieVersion = New-Object -TypeName System.Version -ArgumentList ($ieVersion.Major, $ieVersion.Minor, $ieVersion.Build, $ieVersion.Revision)
[Environment]::SetEnvironmentVariable(“IEVersion”, $ieVersion.Major, “Machine”)
Don’t forget to set it to Run As SYSTEM – you need admin rights to create a Machine environment variable
We will add this to the Computer | Startup trigger
So when we restart the endpoint, we should now see a numeric value set for our environment variable
Incidentally, if you’re wondering where in the Registry Machine environment variables live, it is in HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
And that’s all there is to it – you can now query the base OS installed Internet Explorer version just by matching or querying the environment variable, as necessary (or use it in a script or other software if you’re not a DesktopNow user)
A copy of the configuration to do this can be downloaded here, just to keep you right. Now back to IE 🙁