2009年1月16日星期五

vbs修改注册表 添加IE浏览器信任站点

Windows xp系统可以通过以下脚本来添加域名地址到IE浏览器信任站点
On Error Resume Next
Const HKEY_CURRENT_USER = &H80000001
strUrl_base = "google.com"
strUrl = strUrl_base & "\www"
strComputer = "."
Set objReg = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}\\" & strComputer & _
"\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" _
& "ZoneMap\Domains\" & strUrl_base
objReg.CreateKey HKEY_CURRENT_USER,strKeyPath
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" _
& "ZoneMap\Domains\" & strUrl
objReg.CreateKey HKEY_CURRENT_USER,strKeyPath
strValueName = "http"
dwValue = 2
objReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue
Wscript.Echo "Added http://www.google.com to Trusted sites Zone successfully."
如果是Windows 2003操作系统则需要把注册表路径Domains修改为EscDomains即可。

'**************************************************
Windows xp系统可以通过以下脚本来添加IP地址到IE浏览器信任站点
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WSHShell = CreateObject("WScript.Shell")
on Error resume next
WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\Range111\",""
WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\Range111\http","2","REG_DWORD"
WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\Range111\:Range","192.168.2.11"
Wscript.Echo "Added http://192.168.2.11 to Trusted sites Zone successfully."
如果是Windows 2003操作系统则需要把注册表路径Ranges修改为EscRanges即可。

没有评论: