Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Force Clients to get DHCP DNS entries

Status
Not open for further replies.

djtech2k

MIS
Joined
Jul 24, 2003
Messages
1,097
Location
US
I know I am overlooking an easy way to do this, but here is what I need:

I need to have a script that will force clients that are using DHCP IP's but have a static assigned DNS to now get their DNS from the DHCP server. So, in essence, i need a script to force a client to drop its static assigned DNS and get it from DHCP.

Any ideas?

-DJ
 
Thanks. I do know about netsh, but I cant use it. The thing is that not all clients are XP and I dont know if they have renamed or have multiple netwrok connections. With netsh, you have to hardcode the network connection name.

I put this in thw rong forum here, I got it in the vbscript forum. Actually, I have the answer also:

strComputer = "."
Set wmisrv = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set NIC = wmisrv.ExecQuery ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each objNetAdapter in NIC
errEnable = objNetAdapter.EnableDhcp
errdns1 = objNetAdapter.SetDNSServerSearchOrder(dhcp)
If errEnable = 0 Then
WScript.Echo "The IP address has been changed."
Else
WScript.Echo "The IP address could not be changed."
End If
Next

Thanks for the reply though! Sorry for the wrong forum guys.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top