VBScript subroutine to check IPv6 status in regist

2019-09-18 12:34发布

问题:

I have this subroutine in my script and it is returning -1 as the value of strIPV6Status when the value is actually 0xfffffff in hexadecimal.

Any ideas why this is happening?

'**************************************************************************
'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.GetDWORDValue HKEY_LOCAL_MACHINE, strIPV6Key,strValueName,strIPV6Status
   WScript.Echo(strIPV6Key & strValueName & " = " & strIPV6Status & vbCrLf)

End Sub

回答1:

Not sure what the problem is...believe 0xffffffff is the hex representation for -1 (signed 32-bit int)