I'm trying to write a few short scripts with netsh. One to change an adapter to static addressing and one to change the same adapter back to DHCP.
I can get the adapter set with all of the correct static address settings with
netsh interface ip set address "Local Area Connection" static 10.61.1.253 255.255.255.0 10.61.1.1 1
This works fine. When I run the following command (a script) to switch back to DHCP I get an error message.
netsh interface ip set address "Local Area Connection" dhcp
DHCP is already enabled on this interface.
This is on a Windows 7 machine.
Any idea what the problem is?
It took me a while of "?" in the command to figure this one out as I had the same issue, but here is the syntax that worked for me in Windows 7: netsh interface ip set address name="Local Area connection" source=dhcp