For set DHCP in AD infrastructure
1) you have to create AD GPO with policy for computer startup config with script
@ECHO OFF >NUL
REM Start Script
For /F "TOKENS=2 DELIMS=," %%_ In ('"WMIC NICCONFIG GET InterfaceIndex,IPAddress /FORMAT:CSV | FIND /I "10.1.""') DO (SET MACAddress=%%~_)
netsh interface ipv4 set address %MACAddress% source=dhcp
netsh interface ipv4 set dnsservers %MACAddress% source=dhcp
TIMEOUT /T 10
echo [DHCP]%COMPUTERNAME% %USERNAME%>>\\bdc\Common\rep\info.txt
:end
REM End script
2) Or connect to client PC by psexec
PsExec.exe -h \\{IP or NAME} -u {.\user} -p {pass} cmd
-h means run cmd as Administrator
WMIC NICCONFIG GET InterfaceIndex,IPAddress
InterfaceIndex IPAddress
4
3 {"10.1.x.xx"}
2
netsh interface ipv4 set address 3 source=dhcp
netsh interface ipv4 set dnsservers 3 source=dhcp
OR
netsh interface ip show config
netsh interface ip set dns "Local Area Connection" dhcp
netsh interface ip set dns "Подключение по локальной сети" dhcp