Skip to main content

Modify the Internet Explorer Compatibility List with PowerShell

Here is a good, real world question.  While examining the Group Policies settings for Internet Explorer in class.  The question came about as to whether or not the list can be modified in Group Policy by using PowerShell.  Well, yes you can.

The first thing is to determine what registry key we need to modify.  For the Compatibility list, the key is:
“HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Internet Explorer\BrowserEmulation\PolicyList”

To utilize PowerShell for this task, we first need to add the Group Policy Module.
Import-Module GroupPolicy

Next, to add the website names www.abc.com to the GPO named IE Settings, type:
Set-GPRegistryValue –Name “IE Settings” –Key “HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Internet Explorer\BrowserEmulation\PolicyList” –ValueName “www.abc.com” –Type String –Value “www.abc.com”

Opening the GPO in the Group Policy Management Editor and manually entering the web site would be faster for a single site.  But what if you have a whole list?  That is where we need to turn to a PowerShell script.

The PowerShell code below will allow you to populate the contents of a text file in the Internet Explorer 7 Compatibility list in the GPO of your choice.  This will remove any entries already in the GPO.  Each time it is ran, it purges the compatibility list and recreates it.  For that reason, use the text file as your master list for websites that need to be ran in compatibility mode.

To use this code, copy and paste it into your PowerShell ISE.  Change the file location for the text file and the name of the GPO and run it.

<#===========================================================
Script Name: ManageCompatabilityList.ps1
Version: 1.0
Author: Jason A. Yoder, MCT

Website: www.MCTExpert.com
Blog: www.MCTExpert.BlogSpot.com


Script Purpose:
This script will add websites to the Internet Explorer 7
Compatibility List in a Group Policy.  The website address
will come from a text file.  The text file will completely
manage what is contained in the Compatibility list GPO. If
a website is removed from the text file, or is not in the
it will also be removed from the GPO.

Requirements:
This script has only been tested on a Windows Server 2008 R2
domain controller.



Revision History:
1.0
Created: January 28, 2011
Status: Completed
===========================================================#>



# ===========================================================
# Global Variables



$Website_List = "E:\Compatibility List\Websites.txt"
# file and location of the text file holding the list of
# websites that need to be included in the Compatibility
# list of the GPO.



$GPOName = "IE Settings"
# This is the name of the Group Policy that contains the
# Compatibility List to be modified.



$ListKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Internet Explorer\BrowserEmulation\PolicyList"
# The registry key to be modified. 


# == End of Global Variables ================================


# ===========================================================
# Main Code:



Import-Module GroupPolicy
# Imports the GroupPolicy cmdlets for PowerShell into this
# session.



$ErrorActionPreference = "SilentlyContinue"
# Should the Compatibility list inside the GPO be not
# configured, an error would be generated.  This allows
# the script to continue execution.



# Remove the current contents of the Compatibility List.
Get-GPRegistryValue -Name $GPOName -Key $ListKey | `
Remove-GPRegistryValue -Name $GPOName -Key $ListKey

# Load the list of websites into memory.
$Websites = Get-Content $Website_List


# Add each of the websites to the GPO
For ($i = 0; $i -le $Websites.count-1; $i++)
    {
    Set-GPRegistryValue -Name $GPOName `
    -Key $ListKey -ValueName $Websites[$i] `
    -Type String -Value $Websites[$i]
    }
   
   
$ErrorActionPreference = "Stop"
#Reset the error action mode of PowerShell.


# == End of Main Code =======================================

Comments

Popular posts from this blog

With the AD Recycle Bin Turned on, What Happens when you Create a User Account with a Password that does not meet the Password Policy?

This was an interesting observation from one of my Windows Server 2012 classes.  While working with the AD Recycle bin in a lab, one of my students discovered some interesting accounts that were created. When he created user accounts that did not meet password complexity requirements, an account is temporarily made and then deleted.  When a new password is provided that meets the password requirements, then a new account is made. We discovered this in two places.  First off in the Active Directory Administrative Center.  This is what caused the initial confusion.  Take a look.  This is in the Deleted Objects OU. You can see multiple deleted accounts for Test2 and one for Test3.  Test3 is a valid, functioning user account.  Using the PowerShell command Get-ADObject –IncludeDeletedObjects –Filter * –Properties ObjectSID we can see that indeed, two accounts were created, with one of them deleted. Notice the RID portion of the SID is different. ...

Sticky Key problem between Windows Server 2012 and LogMeIn

This week I instructed my first class using Windows Server 2012 accessed via LogMeIn and discovered a Sticky Key problem every time you press the Shift key. Here is my solution to resolve this.  First off, in the Preferences of LogMeIn for the connection to the Windows Server, click General . Change the Keyboard and mouse priority to Host side user and click Apply at the bottom. On the Windows 2012 server, open the Control Panel – Ease of Access – Change how your keyboard works . Uncheck Turn on Sticky Keys . Click Set up Sticky Keys . Uncheck Turn on Sticky Keys when SHIFT is pressed five times . Click OK twice. If you are using Windows Server 2012 as a Hyper-V host, you will need to redo the Easy of Use settings on each guest operating system in order to avoid the Sticky Key Problem. Updated Information: March 20, 2013 If you continue to have problems, Uncheck Turn on Filter Keys .

Backup and Restore AD LDS with DSDBUTIL.exe

Active Directory Lightweight Directory Services allow you to create a directory service that allows applications to have access to user accounts, groups, and authentication similar to Active Directory Domain Services.  The big advantage here is that the schema of the directory service will not be bound by the rules of an Active Directory database.  Exchange 2007/2010, for example, use an instance of AD LDS on the Edge Transport Server to provide for user authentication from the internet.  Because your Active Directory database is not exposed to the internet, this is more secure. Applications will handle most of the dirty work should they require AD LDS.  You may want to make sure the database is being backed up and also have a restore plan in place.  Should the database become corrupt, the application that uses that database will fail.  This document will walk you through backing up and restoring an instance of AD LDS using the dsdbutil.exe command. Fi...