Создание, настройка и активация областей DHCP
@echo off
@if not «%OS%»==»Windows_NT» (set INFO=echo && set SEXIT=1) else (set INFO=rem && set SEXIT=0)
%INFO% *********************
%INFO% Script: dhcp_config.bat
%INFO% Creation Date: 20.12.2005
%INFO% Author: Nikolay Andrianov
%INFO% Email: slayer@amdclub.ru
%INFO% *********************
%INFO% Description: Скрипт генерации DHCP областей,
%INFO% их конфигурирования и активации.
%INFO% *********************
@if «%sexit%»==»1» goto exit
set server_adress=10.10.1.3
set n_scope=0
set name=1
set IPTMP=10.10.25.
set fullscope=%IPTMP%%n_scope%
set /A router=%n_scope%+1
set /A s_range=%n_scope%+2
set /A e_range=%s_range%+4
set count=1
set count_end=32
:dhcp1
netsh dhcp server %server_adress% add scope %fullscope% 255.255.255.248 RU-POS%name% RU-POS%name%
netsh dhcp server %server_adress% scope %fullscope% add iprange %IPTMP%%s_range% %IPTMP%%e_range%
netsh dhcp server %server_adress% scope %fullscope% set optionvalue 003 IPADDRESS %IPTMP%%router%
netsh dhcp server %server_adress% scope %fullscope% set optionvalue 005 IPADDRESS 10.10.1.2 10.10.1.4
netsh dhcp server %server_adress% scope %fullscope% set optionvalue 006 IPADDRESS 10.10.1.2 10.10.1.4
netsh dhcp server %server_adress% scope %fullscope% set optionvalue 015 STRING domain.ru
netsh dhcp server %server_adress% scope %fullscope% set state 1
if %count% EQU %count_end% goto end1
set /A n_scope=%n_scope%+8
set /A name=%name%+1
set fullscope=%IPTMP%%n_scope%
set /A router=%n_scope%+1
set /A s_range=%n_scope%+2
set /A e_range=%s_range%+4
set /A count=%count%+1
goto dhcp1
:end1
exit