Home > PowerShell > Function: New-TrustedIESite – Add URLs to IE’s Security Zones

Function: New-TrustedIESite – Add URLs to IE’s Security Zones

Description

This function probably doesn’t have a lot of users to most people. But in Lync, adding the Simple URL for the Lync Server Control Panel to the Local Intranet zone resolves the issue of having to enter credentials each time. Of course, I like to automate the configuration of things, so I whipped up this little function, and it will be included in some of my build scripts. The script basically creates the required registry entries under HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains. Immediately after running the function, we can see the new entry in Internet Explorer

Internet Explorer Trusted Intranet Zone

Internet Explorer Trusted Intranet Zone

Syntax

New-TrustedIESite [[-url] ] [[-zone] ] []

Zones are as follows:

1 Local Intranet
2 Trusted Sites
3 Internet
4 Restricted Sites

example:

New-TrustedIESite -url https://lyncadmin.contoso.com -zone 1

Will add https://www.lyncadmin.contoso.com to the Local Intranet zone

Download

v1.0 – 02-08-2014 – New-TrustedIESite.v1.0.zip

  1. PassingBy
    March 10th, 2016 at 10:13 | #1

    It has minor flaw, it does not accept wildcard addresses (Domains) for example all “contoso.com” subdomains: https://*.contoso.com as [System.Uri] does not support wildcards.
    Quick and dirty workaround for this problem:
    $uri = [System.URI] $Url.Replace(‘*’,’wildcard-means-all-hosts’)
    $split = $fqdn.Trim(‘wildcard-means-all-hosts’).Split(‘.’)
    Using string “wildcard-means-all-hosts” as an replacement. (Strange naming is on purpose, to minimize a chance that I would actually hit and subdomain with that name)
    Other than that, excellent script.

    • Pat Richard
      April 7th, 2016 at 12:57 | #2

      Hmmm… that doesn’t seem to work for me. I end up with https://contoso. as the entry. I’ll see if I can track down the issue.

  2. Matt
    September 15th, 2017 at 13:28 | #3

    Did you ever revisit this? Due to formatting, I can’t see what PassingBy changed. Do you have this where it allows wild cards now?

  1. February 9th, 2014 at 19:22 | #1
  2. February 9th, 2014 at 19:25 | #2