Change Network Adapter Setting to DHCP [closed]
Asked Answered
M

2

6

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?

Malady answered 4/4, 2011 at 2:18 Comment(2)
You might want to post this to serverfault.comKeri
So, netsh is not a "software tool primarily used by programmers"? Who uses it primarily, MBAs?Beall
K
4

I had a similar problem with Windows 7. I found that if the link is down on the interface you are trying to modify, you get the message "DHCP is already enabled on this interface." If you plug a cable in (establish a link), the same command works fine.

Kinetic answered 30/7, 2014 at 21:24 Comment(0)
C
2

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

Cucumber answered 27/1, 2012 at 1:41 Comment(3)
Hmm, this didn't work for meMothball
This makes no difference and is just a shortcut to what the original poster did.Glabrous
Well, a "longcut" rather.Glabrous

© 2022 - 2024 — McMap. All rights reserved.