Welcome to ServerForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Forcing machine to use DHCP instead of static for DNS sett..

 
   Windows Server (Home) -> Windows Server Scripting RSS
Next:  Rename Administrator and Guest account  
Author Message
Paul

External


Since: Aug 10, 2004
Posts: 114



(Msg. 1) Posted: Tue Dec 13, 2005 2:05 pm
Post subject: Forcing machine to use DHCP instead of static for DNS settings
Archived from groups: microsoft>public>windows>server>scripting (more info?)

I have a bunch of machines that are currently getting IP address information
from DHCP, however have static DNS servers.

I can not find anything in WMI to change this.

I can shell out and use NETSH, however, I would prefer WMI. Does anybody
know anything that I am missing?

 >> Stay informed about: Forcing machine to use DHCP instead of static for DNS sett.. 
Back to top
Login to vote
/\/\o\/\/

External


Since: Oct 10, 2005
Posts: 234



(Msg. 2) Posted: Tue Dec 13, 2005 11:14 pm
Post subject: Re: Forcing machine to use DHCP instead of static for DNS settings [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Paul wrote:
> I have a bunch of machines that are currently getting IP address information
> from DHCP, however have static DNS servers.
>
> I can not find anything in WMI to change this.
>
> I can shell out and use NETSH, however, I would prefer WMI. Does anybody
> know anything that I am missing?
just clear the DNSServerSearchOrder

SetDNSServerSearchOrder(null)

gr /\/\o\/\/

 >> Stay informed about: Forcing machine to use DHCP instead of static for DNS sett.. 
Back to top
Login to vote
Jason

External


Since: Mar 29, 2006
Posts: 52



(Msg. 3) Posted: Wed May 02, 2007 11:51 am
Post subject: Re: Forcing machine to use DHCP instead of static for DNS settings [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Here is a script that will do it for you:

On Error Resume Next

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colNetCards = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")

For Each objNetCard in colNetCards
arrDNSServers = Array()
objNetCard.SetDNSServerSearchOrder(arrDNSServers)
Next


"/\\/\\o\\/\\/" wrote:

> Paul wrote:
> > I have a bunch of machines that are currently getting IP address information
> > from DHCP, however have static DNS servers.
> >
> > I can not find anything in WMI to change this.
> >
> > I can shell out and use NETSH, however, I would prefer WMI. Does anybody
> > know anything that I am missing?
> just clear the DNSServerSearchOrder
>
> SetDNSServerSearchOrder(null)
>
> gr /\/\o\/\/
>
 >> Stay informed about: Forcing machine to use DHCP instead of static for DNS sett.. 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
change static ip to dhcp - hi, When using wmi to change from static to dhcp using the EnableDHCP method, XP keep static ip and change address to 0.0.0.0 with a subnet mask to 255.0.0.0 is there something else to do befor calling EnableDHCP method ?? i tried this MS sample..

Change from static IP address to DHCP - Hello, I want to create a script to change more than 100 computers from static IP to DHCP. I want to put this in a logon script. The problem will be the registry, as the users have not the the permission to change it? Is there any solution to do this...

RIS and static ip - We have created a small dhcp scope so that the workstations can boot via pxe. However, all workstations are going to use a static ip address. Is there a way to configure the RIS boot menu to enter a static ip address and use it on the workstation. ...

static ip - Hi, Is there any way through a vb script i can see if a computer has a static ip assigned vs a dhcp assigned one? Thanks

Static IP - I have been using the following script toset staic IP addresses but would like to extend it to incorporate setting DNS Server & WINS Server IP Addresses as well. Coud you please help. strComputer = "." Set objWMIService = GetObject(&quo...
   Windows Server (Home) -> Windows Server Scripting All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]