改编自
here
和使用
this kb article
作为来源。脚本首先枚举要检查的值。如果找到DisabledComponents,它就是echo的内容。如果从未找到它,则会回显未找到任何值(这基本上意味着:全部启用)
'**************************************************************************
'IP Address Configuration: Check if ipv6 is disabled
'**************************************************************************
Sub CheckIPV6()
WScript.Echo("Check if IPv6 is disabled")
WScript.Echo("------------------------------------")
Const strIPV6Key = "SYSTEM\CurrentControlSet\services\TCPIP6\Parameters\"
strValueName = "DisabledComponents"
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
objRegistry.EnumValues HKEY_LOCAL_MACHINE, strIPV6Key, arrValueNames, arrTypes
IPv6Disabled = false
For I=0 To UBound(arrValueNames)
IF arrValuesNames(I) = strValueName THEN
objRegistry.GetDWORDValue HKEY_LOCAL_MACHINE, strIPV6Key,strValueName,strIPV6Status
WScript.Echo(strIPV6Key & strValueName & " = " & strIPV6Status & vbCrLf)
IPv6Disabled = true
END IF
NEXT
IF NOT IPv6Disabled THEN
WScript.Echo(strIPV6Key & " no disabled components" & vbCrLf)
END IF
Set objWMIService = GetObject(_
"winmgmts:\\" & strComputer & "\root\cimv2")
Set colNics = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapter ")
objRegistry.GetMultiStringValue HKEY_LOCAL_MACHINE, _
"SYSTEM\CurrentControlSet\services\Tcpip6\Linkage", _
"Bind",bindValues
For Each objNic in colNics
For Each strValue In bindValues
REM DEBUG to see what values are read
WScript.echo strValue & " " & objNic.GUID & " = " & Cstr( objNic.GUID = strValue)
Next
Next
End Sub
WIN32_NetworkAdapter by wmi
Multistring registry read