修改注册表添加IE信任站点及启用Activex控件

来源:互联网 发布:下载拼音打字软件 编辑:程序博客网 时间:2024/05/21 15:46

原创  修改注册表添加IE信任站点及启用Activex控件 收藏

////////////////////////////////////////////////////////////////////////

//

//    添加信息站点及将指定IP添加到本地Intranet中,

//    "*"=dword:00000002 表示受信任的站点区域

//    "*"=dword:00000001 表示本地 Intranet 区域

//

////////////////////////////////////////////////////////////////////////

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet Settings/ZoneMap/Ranges]

@=""

[HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet Settings/ZoneMap/Ranges/Range100]

"*"=dword:00000002

":Range"="192.168.10.121"

[HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet Settings/ZoneMap/Ranges/Range101]

"*"=dword:00000001

":Range"="192.168.10.121"

[HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet Settings/Zones/2]

@=""

"DisplayName"="可信站点"

"CurrentLevel"=dword:00001000

"Flags"=dword:00000043

"1004"=dword:00000000

"1201"=dword:00000000

"1402"=dword:00000000

"2201"=dword:00000000

[HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet Settings/Zones/1]

@=""

"DisplayName"="本地 Intranet"

"CurrentLevel"=dword:00000000

"1001"=dword:00000000

"1004"=dword:00000000

"1201"=dword:00000000

[HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet Settings/Zones/3]

@=""

"DisplayName"="Internet"

"CurrentLevel"=dword:00000000

"1001"=dword:00000000

"1004"=dword:00000000

"1201"=dword:00000000

/////////////////////////////////////////////////////////////////////////////

//

// 通过网页修改activex安全设置,添加信任站点,禁用弹出窗口阻止程序

//

/////////////////////////////////////////////////////////////////////////////

信任站点的注册表项

HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet Settings/ZoneMap/Ranges/Range[*]

ActiveX的注册表项

HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet Settings/Zones/[0-4]/[*]

[0-4]

值           设置

------------------------------

0          我的电脑

1          本地 Intranet 区域

2          受信任的站点区域

3          Internet 区域

4          受限制的站点区域

[*]

1001       下载已签名的 ActiveX 控件

1004       下载未签名的 ActiveX 控件

1200       运行 ActiveX 控件 和插件

1201       对没有标记为安全的 ActiveX 控件 进行初始化和脚本运行

1405       对标记为可安全执行脚本的 ActiveX 控件 执行脚本

2201       ActiveX 控件 自动提示 **

弹出窗口阻止程序 的注册表项

HKEY_CURRENT_USERHKCU/Software/Microsoft/Internet Explorer/New Windows/PopupMgr

具体脚本如下:

<SCRIPT LANGUAGE="JavaScript">

<!--

var WshShell=new ActiveXObject("WScript.Shell");

//添加信任站点ip

WshShell.RegWrite("HKCU//Software//Microsoft//Windows//CurrentVersion//Internet Settings//ZoneMap//Ranges//Range100//","");

WshShell.RegWrite("HKCU//Software//Microsoft//Windows//CurrentVersion//Internet Settings//ZoneMap//Ranges//Range100//http","2","REG_DWORD");

WshShell.RegWrite("HKCU//Software//Microsoft//Windows//CurrentVersion//Internet Settings//ZoneMap//Ranges//Range100//:Range","192.168.0.1");

WshShell.RegWrite("HKCU//Software//Microsoft//Windows//CurrentVersion//Internet Settings//ZoneMap//Ranges//Range101//","");

WshShell.RegWrite("HKCU//Software//Microsoft//Windows//CurrentVersion//Internet Settings//ZoneMap//Ranges//Range101//http","2","REG_DWORD");

WshShell.RegWrite("HKCU//Software//Microsoft//Windows//CurrentVersion//Internet Settings//ZoneMap//Ranges//Range101//:Range","192.168.0.2");

//修改IE ActiveX安全设置

WshShell.RegWrite("HKCU//Software//Microsoft//Windows//CurrentVersion//Internet Settings//Zones//3//1001","0","REG_DWORD");

WshShell.RegWrite("HKCU//Software//Microsoft//Windows//CurrentVersion//Internet Settings//Zones//3//1004","0","REG_DWORD");

WshShell.RegWrite("HKCU//Software//Microsoft//Windows//CurrentVersion//Internet Settings//Zones//3//1200","0","REG_DWORD");

WshShell.RegWrite("HKCU//Software//Microsoft//Windows//CurrentVersion//Internet Settings//Zones//3//1201","0","REG_DWORD");

WshShell.RegWrite("HKCU//Software//Microsoft//Windows//CurrentVersion//Internet Settings//Zones//3//1405","0","REG_DWORD");

WshShell.RegWrite("HKCU//Software//Microsoft//Windows//CurrentVersion//Internet Settings//Zones//3//2201","0","REG_DWORD");

//禁用xinxp弹出窗口阻止程序

WshShell.RegWrite("HKCU//Software//Microsoft//Internet Explorer//New Windows//PopupMgr","no");

alert("active控件 安全设置,弹出窗口设置,信任站点设置成功");

//-->

</SCRIPT>

URL:

比如说我们要把www.Microsoft.com 添加到客户的受信任站点

1.运行regedit,打开注册表,首先打开下面的键值

HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Inte

rnet Settings/ZoneMap/Domains

2.在其下面新建一个项命名为"Microsoft.com"

3.在Microsoft.com下面再新建一个项,命名为"www"

4.在www下新键一个双字节子键,命名为"*","*"表示任何协议,你还可以把

"*"替换为"http","ftp"等其它名称

5.双击刚才新建的双字节子键"*",确保基数里选择是"十六进制",在数值

数据种填写"2"

6.关闭注册表

<SCRIPT LANGUAGE="JavaScript">

<!--

var WshShell=new ActiveXObject("WScript.Shell");

WshShell.RegWrite("HKCU//Software//Microsoft//Windows//CurrentVe

rsion//Internet Settings//ZoneMap//Domains//Microsoft.com","");

WshShell.RegWrite("HKCU//Software//Microsoft//Windows//CurrentVe

rsion//Internet Settings//ZoneMap//Domains//Microsoft.com//www","");

WshShell.RegWrite("HKCU//Software//Microsoft//Windows//CurrentVe

rsion//Internet

Settings//ZoneMap//Domains//Microsoft.com//www//http","2","REG_DWORD"

);

alert("写入成功");

//-->

</SCRIPT>

附VB.NET代码

还原

 Dim reg As RegistryKey
            reg = Registry.CurrentUser

            '0:          我的电脑()
            '1          本地 Intranet 区域
            '2:          受信任的站点区域()
            '3:          Internet(区域)
            '4:          受限制的站点区域()
            reg = reg.OpenSubKey("Software/Microsoft/Windows/CurrentVersion/Internet Settings/Zones/2", True)
            '1001       下载已签名的 ActiveX 控件
            reg.SetValue("1001", "1")
            '1004       下载未签名的 ActiveX 控件
            reg.SetValue("1004", "3")
            '1200       运行 ActiveX 控件和插件
            reg.SetValue("1200", "0")
            '1201       对没有标记为安全的 ActiveX 控件进行初始化和脚本运行
            reg.SetValue("1201", "3")
            '1405       对标记为可安全执行脚本的 ActiveX 控件执行脚本
            reg.SetValue("1405", "0")
            '2201       ActiveX 控件自动提示 **
            reg.SetValue("2201", "3")

            reg = reg.OpenSubKey("Software/Microsoft/Windows/CurrentVersion/Internet Settings/Zones/3", True)
            '1001       下载已签名的 ActiveX 控件
            reg.SetValue("1001", "1")
            '1004       下载未签名的 ActiveX 控件
            reg.SetValue("1004", "3")
            '1200       运行 ActiveX 控件和插件
            reg.SetValue("1200", "0")
            '1201       对没有标记为安全的 ActiveX 控件进行初始化和脚本运行
            reg.SetValue("1201", "3")
            '1405       对标记为可安全执行脚本的 ActiveX 控件执行脚本
            reg.SetValue("1405", "0")
            '2201       ActiveX 控件自动提示 **
            reg.SetValue("2201", "3")

修改

 Dim reg As RegistryKey
                    reg = Registry.CurrentUser
                    reg = reg.CreateSubKey("Software/Microsoft/Windows/CurrentVersion/Internet Settings/ZoneMap/Domains/" & m_UserInfo.serverIP)
                    reg = reg.CreateSubKey("Software/Microsoft/Windows/CurrentVersion/Internet Settings/ZoneMap/Domains/" & m_UserInfo.serverIP & "/www")
                    reg.SetValue("http", "2")

                    '0:          我的电脑()
                    '1          本地 Intranet 区域
                    '2:          受信任的站点区域()
                    '3:          Internet(区域)
                    '4:          受限制的站点区域()
                    reg = reg.OpenSubKey("Software/Microsoft/Windows/CurrentVersion/Internet Settings/Zones/2", True)
                    '1001       下载已签名的 ActiveX 控件
                    reg.SetValue("1001", "0")
                    '1004       下载未签名的 ActiveX 控件
                    reg.SetValue("1004", "0")
                    '1200       运行 ActiveX 控件和插件
                    reg.SetValue("1200", "0")
                    '1201       对没有标记为安全的 ActiveX 控件进行初始化和脚本运行
                    reg.SetValue("1201", "0")
                    '1405       对标记为可安全执行脚本的 ActiveX 控件执行脚本
                    reg.SetValue("1405", "0")
                    '2201       ActiveX 控件自动提示 **
                    reg.SetValue("2201", "0")

                    reg = reg.OpenSubKey("Software/Microsoft/Windows/CurrentVersion/Internet Settings/Zones/3", True)
                    '1001       下载已签名的 ActiveX 控件
                    reg.SetValue("1001", "0")
                    '1004       下载未签名的 ActiveX 控件
                    reg.SetValue("1004", "0")
                    '1200       运行 ActiveX 控件和插件
                    reg.SetValue("1200", "0")
                    '1201       对没有标记为安全的 ActiveX 控件进行初始化和脚本运行
                    reg.SetValue("1201", "0")
                    '1405       对标记为可安全执行脚本的 ActiveX 控件执行脚本
                    reg.SetValue("1405", "0")
                    '2201       ActiveX 控件自动提示 **
                    reg.SetValue("2201", "0")