Use bat script to add trusted site for IE

1

1

I just wrote a bat script file which add trusted site for ie. In my bat script, I add a entry to this location:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains

it does't work, but I can see my site was added in the ie security option panel.

and I also note that, when you add trusted site in ie, a registry entry will be added to :

HKEY_USERS\S-1-5-21-1954385965-2893531047-659543403-1001\Software\Microsoft\Windows\CurrentVersion\Ext\Stats\{1DABF8D5-8430-4985-9B7F-A30E53D709B3}\iexplore\AllowedDomains

I don't know why, any one know the right way to add trusted site using bat script ? here is my code:

@Echo off&title gworks
set "a=HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\"
set b=192.168.1.100
reg add "%a%%b%" /v http /t REG_DWORD /d 2 /f >nul 2>nul
reg add "%a%%b%" /v https /t REG_DWORD /d 2 /f >nul 2>nul

after I execute it as administrator: enter image description here

Many Dollars

Posted 2014-01-09T14:59:46.557

Reputation: 137

What version of Windows and IE? – CharlieRB – 2014-01-09T15:17:31.907

@CharlieRB I run it on windows 7 with IE 8 – Many Dollars – 2014-01-09T15:22:14.910

Answers

2

Here is a TechNet posting which might help you.

DISCLAIMER: Use at your own risk. It is advisable to make backups before proceeding.

Adding trusted Sites for all users

The answer marked as correct states:

Try to add these four keys.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\mytest.org]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\mytest.org\pacs] "https"=dword:00000002

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\EscDomains\mytest.org]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\EscDomains\mytest.org\pacs] "https"=dword:00000002

CharlieRB

Posted 2014-01-09T14:59:46.557

Reputation: 21 303

This does not seem to work with Internet Explorer 11 on Windows 8.1. – Dai – 2014-10-05T23:33:16.953

1That's because this answer is for Windows 7. – CharlieRB – 2014-10-06T11:26:21.020