求将ip添加到 浏览器可信站点的vbs脚本

superXwoman_ 2010-10-11 03:48:51
http://192.168.1.135

求将此ip添加到 浏览器可信站点的 脚本
...全文
329 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
ccbccb 2011-04-08
  • 打赏
  • 举报
回复
在微软的《Hey script guy》里面刚好有一个这样的实例:

How Can I Add a Web Site to the Trusted Sites Zone?



Hey, Scripting Guy! How can I add a Web site to the Trusted Sites zone in Internet Explorer?

-- NR



Hey, NR. As it turns out, trusted sites are actually stored in the registry; consequently, adding a Web site is simply a matter of creating and configuring a new registry key. For example, suppose you want to trust Microsoft.com. (And, really, who doesn’t want to trust Microsoft?) Here’s a script that adds Microsoft.com to the list of trusted sites:



On Error Resume Next

Const HKEY_CURRENT_USER = &H80000001

strComputer = "."
Set objReg=GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" _
& "ZoneMap\Domains\microsoft.com"

objReg.CreateKey HKEY_CURRENT_USER, strKeyPath

strValueName = "http"
dwValue = 2

objReg.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue



Let’s talk about what’s going on here. We begin by creating a constant HKEY_CURRENT_USER and setting it to the value &H80000001. This constant will be used to access the HKEY_CURRENT_USER portion of the registry and configure Microsoft.com as a trusted site for only the logged-on user. What if you wanted to configure Microsoft.com as a trusted site for anyone logging on to the computer? In that case, substitute the constant HKEY_LOCAL_MACHINE for HKEY_CURRENT_USER, and assign HKEY_LOCAL_MACHINE the value &H80000002.



Next we connect to the WMI service and, more specifically, to the Standard Registry Provider. We then assign the following registry path to the variable strKeyPath:



Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\microsoft.com



Note the tail-end of the path: that’s where we put microsoft.com, the name of the Web site to be added to the trusted sites. We then call the CreateKey method to create a new registry key (microsoft.com) inside Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains.



Still with us? Having created the registry key, we simply need to create and configure a single registry value. In our sample script, we assign the value http to the variable strValueName. This will be the name of our new registry value; it also indicates which Internet protocols will be trusted from Microsoft.com. If we want to trust only the ftp protocol, then we’d assign strValueName the value ftp; if we want to trust all Internet protocols, then we’d assign strValueName the value * (a single asterisk).



We then assign the value 2 to the variable dwValue. In the world of Internet Explorer, the 2 represents the Trusted Sites zone. You could also use the value 1 to assign a site to the Intranet Sites zone; the value 3 to assign a site to the Internet Sites zone; or the value 4 to assign a site to the Restricted Sites zone.



Finally we use the SetDWORDValue method to create our new registry value. Fire up Internet Explorer, click on Tools, click on Internet Options, and then, on the Security tab, select Trusted Sites and click the Sites button. You should see Microsoft.com among the trusted sites.




ouling168 2010-10-20
  • 打赏
  • 举报
回复
可以通过修改注册表中ie的信息来实现。
Rotel-刘志东 2010-10-11
  • 打赏
  • 举报
回复
打开浏览器属性,打开可信站点-直接添加就可以了。

4,008

社区成员

发帖
与我相关
我的任务
社区描述
它是一种微软环境下的轻量级的解释型语言,它使用COM组件、WMI、WSH、ADSI访问系统中的元素,对系统进行管理。
社区管理员
  • vbScript社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧