Y
Y
Yamazaki2015-05-05 07:47:03
DHCP
Yamazaki, 2015-05-05 07:47:03

How to switch network from static IP addresses to DHCP?

I created a batch file with the following command: netsh interface ip set address name="Network connection name" source=dhcp (actually 6 lines, because there are 6 names of network connections in our network, somewhere it is "Local network" , somewhere "Local Area Connection 2", etc.).
Then I created a GPO, which I tied to the domain and set the batch file to start the computer (when I set it to "Users", nothing switched, probably the rights of the "User" account are not enough to change the network settings).
Now my computers with Windows XP switch to getting an address from a DHCP server on reboot, but not with Windows 7.
What can be done?
The second method with the command "wmic path win32_networkadapterconfiguration where "ipenabled = true" call setdnsserversearchorder(server dns address)" can't get it to work even for a test.
I also googled through the PSEXEC utility, but I also don’t think the rights are enough.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene, 2015-05-05
@yellowmew

An example on Powershell in one line if there is exactly one network adapter in the system (you need to configure a powershell remote connection for the domain and somehow prepare a list of computers on which you want to run the script):
Basically this command:

(Get-WMIObject Win32_NetworkAdapterConfiguration | where{$_.IPEnabled -eq $true -and $_.DHCPEnabled -eq $false}).EnableDHCP()
you can put a script in powershell and execute using GPO

A
Andrey Ermachenok, 2015-05-05
@eapeap

total in our network 6 types of network connections

How many computers?
Isn't it easier to bypass everyone once, switch to DHCP and forget?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question