How to change to Obtain DNS Server address automatically

  • Thread starter Thread starter Poom
  • Start date Start date
P

Poom

Hi;
I am going to setup DHCP server on Windows 2000 Server. Currently, our
network is using static IP Address. Instead of I have to visit all clients,
I can use "Netsh" command to change static IP to Obtain IP from DHCP.
HOWEVER, How can I update DNS from static to Obtain DNS server address
automatically without visit all client?
thank you...
POOM
 
In dhcp manager right click on the scope options and select configure
options. Select option 015 dns domain name and add the name of the domain
you want to add.

Lee
 
Thank for your answer.. sorry, I am a slow learner.
On Obtain DNS automatically (under Local Area Connection Properties ->
Internet Protocal TCP/IP
properties).. How can I change it from fix DNS to automatically on CLIENTS?
I do not want to go on each computer and change it manually.
Is there any other way such as a srcipt?
Thanks
Poom
 
I think you may have to visit each desktop to set it to dhcp...maybe someone
else knows another way.

Lee
 
I found this code in the script repository. I guess you could place it as a
shutdown script and the next time the computer boots it would be a dhcp
client. Post to the group if you need any help in assigning it.



Lee



Enabling DHCP

Description
Enables the DHCP client service on a computer. The computer will then use
DHCP to obtain an IP address rather than use a static IP address.

Script Code

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each objNetAdapter In colNetAdapters
errEnable = objNetAdapter.EnableDHCP()
If errEnable = 0 Then
Wscript.Echo "DHCP has been enabled."
Else
Wscript.Echo "DHCP could not be enabled."
End If
 
Back
Top