How can I perform a migration to DHCP?

John Savill

June 4, 1999

2 Min Read
ITPro Today logo in a gray background | ITPro Today

A. A. There are only a few basic registry entries that define a clientas a DHCP client so an easy way to migrate clients to DHCP is to create aregistry script that sets the required values via logon script. You shouldobviously be careful that there is no overlap between the addresses in the DHCPaddress pool and those statically assigned.

The DHCP service needs to be configured to start at system startup.Go toHKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesDHCP and change the valueentry Start from 1 to 2.

TCPIP parameters are defined to each NIC (Network Interface Card).

The following is an example registry script you may consider using. If youare unsure of the card service gotoHKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionNetworkCards1and write down the data for the value entry ServiceName

REGEDIT4

[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesParametersTcpip]
"EnableDHCP"=dword:00000001
"IPInterfaceContext"=dword:00000001
"IPInterfaceContextMax"=dword:00000001

You should then add something into the logon script to detect the NICinstalled into the computer, run the reg script and request an IP address, e.g.

if reg=elpc575 (for the 3com575tx) goto dhcp
..
..
..
:dhcp
regedit /s NIC_dhcp.reg
ipconfig /renew
net send %computername% Congrats Your computer has been configured for DHCP!
endif

A quick way to find out which network card you are using is on you LAN youwill have various types of NIC.

For instance you may have the 3c89d, netflx3,3c575tx for instance for theNeflx3 driver, when the install takes place on the NT 4.0 it adds a registrykey in the HKEY_LOCAL_MACHINEsystemsCurrent controlsetsystemservicescpqNF31 with the parameters:

[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesCpqNF31ParametersTcpip]
"EnableDHCP"=dword:00000000.

You have to find out what the key name is because it is different for eachNIC then you can run kix32.exe and use the arguement:

EXISTKEY (
"Key"
)

Checks for the existence of a registry key.

Parameters
Key - Identifies the key you want to check the existence of.

Returns
0 the key specified exists (Note : this is different from the way the EXISTfunction works...)
>0 the key does not exist, returncode represents an errorcode

$ReturnCode=ExistKey(
"HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesCpqNF31" )

If $ReturnCode=0
? "Key exists...."
Endif

...to detemine if the key exist and then execute accordingly for thatspecific card.

You may also set the value IPAddress=0.0.0.0 and value SubnetMask=0.0.0.0for the card service however they will be ignored anyway. Fill in the IPAddressand SubnetMask with 0.0.0.0. Blanking out or deleting the values won't work.Restart the workstation to complete the change.

This can also be done using Windows Scripting Host

From MS SupportOnline Article ID: Q197424
'-----------------------------------------------------------------------   ' 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.   ' ----------------------------------------------------------------------   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 = "HKLMSystemCurrentControlSetServicesClassNetTrans"   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.

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like