HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionInternet SettingsZones3
您能看到 3 被追加到了末尾处。要访问 Intranet 站点区域(值 1)的设置?没问题:
HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionInternet SettingsZones1
找到正确的注册表子项后,您需要知道要读取哪个注册表值。遗憾的是(至少对于脚本编写者来说),这些注册表值的名称有点含糊;例如,我们感兴趣的名称为 1200。(为什么是这样呢?我们不知道。)如果您对使用脚本来读取/管理 Internet Explorer 设置感兴趣,那么,您可能希望阅读一下 Managing Internet Explorer Enhanced Security Configuration whitepaper(英文)。仅一部分文档会涉及脚本编写,但是,该部分的确将这些含糊的注册表值映射到了用户界面中的相应属性。当然,许多这样的设置都可在 Tweakomatic 中找到。(Tweakomatic 与白皮书不同,它会真正地为您编写脚本。)
那么,我们已准备最终编写一个脚本并真的在此执行一些操作吗?几乎是这样。您需要知道的另一件事就是配置信息作为双字节(数字)值被存储在注册表中。如果您知道 ActiveX 控件被配置为 3 而不是 65536,这会有所帮助吗?可能没有。不过,下表可能有所帮助:
|
注册表值 |
用户界面值 |
|
0 |
Enabled |
|
1 |
Prompt |
|
3 |
Disabled |
|
65536 |
Administrator Approved |
不,最后一个值并非印刷错误,它的确为 65536。自己去想吧。
那好,现在我们就准备编写一个脚本。下面的这个示例脚本可检索 Intranet 站点区域(区域值 1)的设置信息:
HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set objReg = GetObject("winmgmts:" & strComputer & "rootdefault:StdRegProv")
strKeyPath = "SoftwareMicrosoftWindowsCurrentVersionInternet SettingsZones1"
ValueName = "1200"
objReg.GetDWORDValue HKEY_CURRENT_USER, strKeyPath, ValueName, dwValue
Wscript.Echo "Run ActiveX Controls and Plug-ins"
If IsNull(dwValue) Then
Wscript.Echo "Intranet sites: The value is either Null or could not be found in the registry."
ElseIf dwValue = 0 Then
Wscript.Echo "Intranet sites: Enabled"
ElseIf dwValue = 1 Then
Wscript.Echo "Intranet sites: Prompt"
ElseIf dwValue = 3 Then
Wscript.Echo "Intranet sites: Disabled"
ElseIf dwValue = 65536 Then
Wscript.Echo "Intranet sites: Administrator Approved"
End If







