在部署dhcp过程中,为了提高工作效率,特写此脚本,
并在主域控制器建立组策略dhcp:
1、启用dhcp client 、dns client rpc服务
2、用户配置->windows设置->脚本(登陆/注销)
然后将策略应用到需要的ou或者域中 最后gpupdate /force
下次即可启用客户端的dhcp,且对客户端是透明的。
等客户端全部刷新策略完毕后将此组策略删除即可。
@echo off
@rem off
@rem off
@mode con cols=80 lines=42
title Dhcp configuration created for coolfire clients
rem created by coolfire @20091108
title Dhcp configuration created for coolfire clients
rem created by coolfire @20091108
sc config dhcp start= auto
sc config dnscache start= auto
sc start dhcp
sc start dnscache
setlocal enabledelayedexpansion
setlocal enabledelayedexpansion
for /f "tokens=2*" %%i in ('ipconfig ^|find "Ethernet adapter"') do (
set j=%%j
set j=!j:~,-2!)
echo.
netsh interface ip set address name="%j%" dhcp
netsh interface ip set dns name="%j%" dhcp
ipconfig/setclassid "%j%" office
echo.
echo.
echo 如有其它疑问请致电:coolfire xxx-xxxxxx
echo.
pause
sc config dnscache start= auto
sc start dhcp
sc start dnscache
setlocal enabledelayedexpansion
setlocal enabledelayedexpansion
for /f "tokens=2*" %%i in ('ipconfig ^|find "Ethernet adapter"') do (
set j=%%j
set j=!j:~,-2!)
echo.
netsh interface ip set address name="%j%" dhcp
netsh interface ip set dns name="%j%" dhcp
ipconfig/setclassid "%j%" office
echo.
echo.
echo 如有其它疑问请致电:coolfire xxx-xxxxxx
echo.
pause
此脚本在附件中 请点击下载
转载于:https://blog.51cto.com/coolfire/235088