We are currently redesigning our network at Williams &amp; Fudge with the help of the guys at eGroup.

One of my responsibilities before we start converting to vlans (Yes, we have a flat network right now) is to convert all of our PCs and VoIP phones to DHCP.  With 265 PCs, that is not something I want to do manually.  And of course, my users are not capable of doing it themselves.

So here's a handy VBS script I found over on the technet community at this <a href="http://gallery.technet.microsoft.com/scriptcenter/en-us/5884b62f-0a69-48e2-af16-3c4fcc060161" target="_blank">link</a>.
<code>strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
&amp; "{impersonationLevel=impersonate}!\" &amp; strComputer &amp; "rootcimv2") </code>

<code>Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")</code>

<code> </code>

<code>For Each objNetAdapter In colNetAdapters
errEnable = objNetAdapter.EnableDHCP()
Next</code>

<strong>*NOTE: This only works on Windows XP, Server 2000, and Server 2003.*</strong>

UPDATE - Well after the 5-hour energy drinks were had, we realized the script above doesn't change from static DNS to dynamic DNS.  Here's the script for that:
<code>
strComputer = "."</code>

<code>Set objWMIService = GetObject("winmgmts:\" &amp; strComputer &amp; "rootcimv2")

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

</code>

<code>For Each objNetCard in colNetCards
arrDNSServers = Array()
objNetCard.SetDNSServerSearchOrder(arrDNSServers)
Next</code>