Information Technology Reference
In-Depth Information
Set nics = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
For Each nic in nics
strGUID = nic.SettingID
' only populate the alternate IP information for the correct NIC
If strGUID = strTargetGUID Then
' make sure that DHCP is enabled
If nic.DHCPEnabled = False Then
Wscript.Echo("Error! DHCP must be enabled for " _
& "alternate IP configurations to function.")
' now you can get to work
Else
' first enable alternate IP configuration for this NIC
strPath = "SYSTEM\CurrentControlSet\Services\" _
& "Tcpip\Parameters\Interfaces\" & strGUID
strValue = "ActiveConfigurations"
strRegValue = "Alternate_" & strGUID
arrValues = Array(strRegValue)
Set Registry = GetObject _
("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
Registry.SetMultiStringValue HKEY_LOCAL_MACHINE, strPath, _
strValue, arrValues
' now populate the alternate config with the appropriate values
' the first 20 values of the blob are fixed
arrBlobValues(0) = &H32
arrBlobValues(1) = &H00
arrBlobValues(2) = &H00
arrBlobValues(3) = &H00
arrBlobValues(4) = &H00
arrBlobValues(5) = &H00
arrBlobValues(6) = &H00
arrBlobValues(7) = &H00
arrBlobValues(8) = &H04
arrBlobValues(9) = &H00
arrBlobValues(10) = &H00
arrBlobValues(11) = &H00
arrBlobValues(12) = &H00
arrBlobValues(13) = &H00
arrBlobValues(14) = &H00
arrBlobValues(15) = &H00
Search WWH ::




Custom Search