http://dieseyer.de • all rights reserved • © 2011 v11.4

'-----------------------------------------------------------------------
' The following script reads the registry value name IPAddress to
' determine which registry entries need to be changed to enable DHCP.
' This sample checks the first 11 network bindings for TCP/IP, which is
' typically sufficient in most environments.
' ----------------------------------------------------------------------
' from http://support.microsoft.com/default.aspx?scid=kb;EN-US;q197424
Dim WSHShell, NList, N, IPAddress, IPMask, IPValue, RegLoc
Set WSHShell = WScript.CreateObject("WScript.Shell")

NList = array("0000","0001","0002","0003","0004","0005","0006", "0007","0008","0009","0010")

On Error Resume Next
RegLoc = "HKLM\System\CurrentControlSet\Services\Class\NetTrans\"

For Each N In NList
IPValue = "" 'Resets variable
IPAddress = RegLoc & N & "\IPAddress"
IPMask = RegLoc & N & "\IPMask"
IPValue = WSHShell.RegRead(IPAddress)
If (IPValue <> "") and (IPValue <> "0.0.0.0") then
WSHShell.RegWrite IPAddress,"0.0.0.0"
WSHShell.RegWrite IPMASK,"0.0.0.0"
end If
Next

WScript.Quit ' Tells the script to stop and exit.


http://dieseyer.de • all rights reserved • © 2011 v11.4