You may need sometimes to change from Static IP to DHCP. We all know that this is very easy to do.
But what happens when you need to change that on a Whole Network or lets say 100+ PCs.
If you are on a domain this can be easily achieved by using Group Policy. (This has been tested from Windows XP SP3 to Windows 7 SP1)
Create a batch file with the following contents: (I am assuming you have not touched the name of the Connection or have multiple adapters)
netsh interface ip set address name=”Local Area Connection” source=dhcp
netsh interface ip set dns name=”Connection” source=dhcp
Create a New Policy or modify an existing one that Links to your Computers (be careful not to apply this on your whole domain as it will set Server IPs to DHCP also).
Computer Configuration —> Policies —> Windows Settings —> Scripts —> Startup Script —> Add —> Paste Batch File here and Select it. (Or Click on Show Files & Drop the file there, then click on Add and you should see the file).
Since this is a Computer Configuration it is recommended to Restart the Computer.
With above script DNS settings will still remain static.Kindly help to change the DNS setting to DHCP also