IE Exceptions (Trusted Sites)

The most criticized browser over the years continues to be widely used in specific cases such as companies that don't want to invest into upgrading software or hardware.
Whatever software or hardware you need to repeatedly add IE exceptions to, here is a short script to make the task a click away.

Let´s start

IE Trusted sites

To add the exceptions in the Trusted Sites Zone we need a subfolder and 3 keys, on every site we need.

The path to create the keys

strRegKey = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\"

In addition to the path we have to create the subfolder with site name.

First key is the default key

WshShell.RegWrite strRegKey & Site & "\" ,"" , "REG_SZ"

The "Site" variable is the site name to create the subfolder

Second key contains the name or IP we want to add

WshShell.RegWrite strRegKey & Site & "\" & ":Range" , Site, "REG_SZ"

And the last one is to set the zone map we want, in this example we chose Trusted Sites but we can add to the other zones too.

ValueSetting
0My Computer
1Local Intranet Zone
2Trusted Sites Zone
3Internet Zone
4Restricted Sites Zone

WshShell.RegWrite strRegKey & Site & "\*", "2", "REG_DWORD"

Script

Exception "192.168.100.100"
Exception "192.168.100.101" 

Function Exception(Site) 

  Set WshShell = Wscript.CreateObject("Wscript.Shell") 

'------Trusted Sites------'

    strRegKey = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\"

	 WshShell.RegWrite strRegKey & Site & "\" ,"" , "REG_SZ"

   	 WshShell.RegWrite strRegKey & Site & "\" & ":Range" , Site, "REG_SZ"

   	 WshShell.RegWrite strRegKey & Site & "\*", "2", "REG_DWORD"


End Function

Leave a Reply

Your email address will not be published. Required fields are marked *

*