我有一个脚本可以将可信站点添加到IE。
Const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set objReg=GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" _
& "ZoneMap\Domains\" & "https://www.google.com"
objReg.CreateKey HKEY_CURRENT_USER, strKeyPath
strValueName = "*"
dwValue = 2
objReg.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue
成功添加受信任的网站。但这里有一个问题.... 我无法删除通过脚本添加的可信站点,这是一个严重的问题
提前致谢。
答案 0 :(得分:2)
'**************************************************************************
'VBScript to remove all IE opened tab urls from the Trusted Site list
'***************************************************************************
Dim Windows
Dim tabUrl
On Error Resume Next
Const HKEY_CURRENT_USER = &H80000001
Set Shell = CreateObject("Shell.Application")
Set Windows = CreateObject(Shell.Windows)
For Each Window In Shell.Windows
If InStr(1, Window.FullName, "iexplore.exe", vbTextCompare) > 0 Then
tabUrl = Window.LocationUrl
Msgbox tabUrl
strComputer = "."
Set objReg=GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" & "ZoneMap\Domains\" &tabUrl
objReg.DeleteKey HKEY_CURRENT_USER, strKeyPath
strValueName = "*"
dwValue = 2
objReg.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue
End If
Next
答案 1 :(得分:0)
The Scripting Guys文章告诉您如何删除密钥并告诉您删除有时无效的原因