Nov 112014
 

Here is a way for you to keep your EMIE site list up to date using CI. Enterprise Mode IE is Microsoft’s method for allowing backwards compatibility with sites that do not fully support Internet Explorer 11’s Edge mode. I don’t go into detail about how to set up EMIE, more information on how to set it up can be found via MSDN.

First we start with the detection script. This script returns the version number of your site list XML. Be sure to replace the $file string listed with the correct path and file name of your EMIE list XML.

 
# EMIE XML Version Check (Detection) Script for CM12 Compliance Settings
# by Robert Hollingshead

# November 11th, 2014
# Find more CM12 Compliance Setting scripts at occurative.com!

# Supress error messages.
$ErrorActionPreference = "SilentlyContinue"

# Enter the path and name of the XML file here. 
$file = '{enter path and filename here}'

# Get the XML Content and then unwrap its tags into individual lines.
# We could leave out the split method and just go by the entire InnerXml,
# but IMHO, this way makes more sense and is friendly to ANY 
# odd modifications of the remediation script should they be needed. 

Try {
    [xml]$sites = Get-Content $file
    $unwrappedsites = $sites.innerxml.split('</>')

    # Look for the rules version, split out the line, 
    # and output the second string which will be the
    # version itself. 

    ForEach($line in $unwrappedsites) {
        if ($line -like "*rules version*") {
            write-host $line.split('"')[1]
            break
        }
    }

    # If the split of $sites failed, we'll catch it and
    # spit out versin 0 to indicate the file doesn't exist.

    } catch {   
    write-host 0
}

The detection script is going to return the current version of the XML file on the client, not a true or false. So your compliance rule will be equal to the version you want all your clients to be at. How to get that updates can be done via this remediation script. First thing, there are two values that must be changed, the $version, and the $file strings. $version will be the equal to the version you want all your clients to be at. Make sure  you have it set to the same version as in your compliance rule or you’ll never be compliant. The second is the $file string, which will be the same as in the detection script.

Next  you will add all the domains. There are four lines beginning with “$domain = New-Object PSOBject.” We are building an array of Domains as well as if they are to be excluded or included in EMIE. Each domain will be a TLD. True means “exclude this site from EMIE” and is useful for preventing an intranet site from running in compatibility mode. False means “include this site in EMIE” and is useful for placing a site on the internet in compatibility mode, or if the site is setting its compatibility via META tag and you wish to override. Here is the script, stay tuned after the script for a few notes.

# EMIE XML Update (Remediation) Script for CM12 Compliance Settings
# by Robert Hollingshead

# November 11th, 2014
# Find more CM12 Compliance Setting scripts at occurative.com!

# This script keeps your EMIE (Enterprise Mode IE 11) XML up to date.

# Enter the resultant version here. This is your XML list version.
# Increment when there are changes. 
# Make sure that you change the compliance rule to match. 
$version = "{enter version number here}"

# Enter the path and name of the XML file here. 
$file = '{enter path and filename here}'

# Setup Array for domains and the resulting xml 

[system.array]$domains = $null
[system.array]$sitesxml = $null

#Add domain here.
#False indicates that EMIE should run for non-intranet site. 
#False also indicates that EMIE should run for intranet sites that are saying they are
#compatible via server meta tag.
#True indicates that EMIE should not run for intranet site. 
# Copy the following four lines for each new domain. Don't forget to increment the version
# if you make any changes. 
$domain = New-Object PSObject
$domain | Add-Member -membertype noteproperty -Name Domain -Value "{tld like microsoft.com}"
$domain | Add-Member -membertype noteproperty -Name Exclude -Value "{false or true}"
$domains = $domains + $domain


#Now let's write out the XML. We build an array that will be written out to file. 

# Compile the version line and the opening EMIE tag.
$line = New-Object PSObject
$line = ''
$sitesxml = $line
$line = '  '
$sitesxml = $sitesxml + $line

# Compile the domain tags.
ForEach ($domain in $domains) {
    $line = '    ' + $domain.Domain + ''
    $sitesxml = $sitesxml + $line
}

# Compile the closing tags.
$line = '  '
$sitesxml = $sitesxml + $line
$line = ''
$sitesxml = $sitesxml + $line

# Output to the file. 
$sitesxml | out-file $file

write-host TRUE

Obviously there is some room for improvement in this script. While I can include TLD’s right now, I cannot include subdomains just yet, that ability will be forthcoming in another update of this script, or if you wish to update it yourself and contribute back that is fine too.

Enjoy!