@echo off
set fol=1
set input=
set count=0
set extnumber=
set pin=
set authp=
set serverip=
set username=
set local=1
set copies=
set cpcount=0
set VoipPhoneCount=1
set confcount=0
:COPYORNOTLOOP
echo ===============================
echo ===============================
echo VOIP PHONE DEPLOYMENT
echo ===============================
echo ===============================
set /P copies=How many Voip Phones are you going to Deploy. The Number of copies you want will be created in C:\VPC: %=%
goto :COPYLOOP
:COPYLOOP
set cpfol=1
copy c:\VPC\3CX VoIP Phone c:\VPC\3CX VoIP Phone%cpfol%
set /A cpcount=%cpcount%+1
set /A cpfol=%cpfol%+1
echo.
echo.
echo.
echo.
If %cpcount% lss %copies% goto :COPYLOOP
if %cpcount%==%copies% goto :CONFIGLOOP
:CONFIGLOOP
echo ==============================================================
echo ==============================================================
echo VOIP PHONE #%VoipPhoneCount% : Extension Settings
echo ==============================================================
echo ==============================================================
echo.
set /P extnumber=Enter the Extension Number for this Voip Phone: %=%
echo.
set /P pin=Enter the Pin for this Voip Phone: %=%
echo.
set /P authp=Enter the Auth Pass for this Voip Phone: %=%
echo.
set /P serverip=Enter the IP of the PBX: %=%
echo.
set /P username=Enter the Caller ID of this Voip Phone: %=%
set /A VoipPhoneCount=%VoipPhoneCount%+1
goto :LOOP
:LOOP
pushd "c:\VPC\3CX VoIP Phone%fol%"
goto :LOOP2
:LOOP2
set Var1=CallerID=%username%
@echo off & setlocal EnableDelayedExpansion
for /F "delims=" %%j in ('find /v "" ^< "c:\VPC\3CX VoIP Phone%fol%\3cxvoipPhone.ini"') do (
set line=%%j
set line=!line:CallerID=%Var1%!
echo.!line!>> "c:\VPC\3CX VoIP Phone%fol%\3cxvoipPhone.new"
)
del "c:\VPC\3CX VoIP Phone%fol%\3cxvoipPhone.ini"
rename "c:\VPC\3CX VoIP Phone%fol%\3cxvoipPhone.new" *.ini
popd
goto :LOOP3
:LOOP3
set Var2=AuthUser=%extnumber%
@echo off & setlocal EnableDelayedExpansion
for /F "delims=" %%j in ('find /v "" ^< "c:\VPC\3CX VoIP Phone%fol%\3cxvoipPhone.ini"') do (
set line=%%j
set line=!line:AuthUser=%Var2%!
echo.!line!>> "c:\VPC\3CX VoIP Phone%fol%\3cxvoipPhone.new"
)
del "c:\VPC\3CX VoIP Phone%fol%\3cxvoipPhone.ini"
rename "c:\VPC\3CX VoIP Phone%fol%\3cxvoipPhone.new" *.ini
popd
goto :LOOP4
:LOOP4
set Var3=AuthID=%pin%
@echo off & setlocal EnableDelayedExpansion
for /F "delims=" %%j in ('find /v "" ^< "c:\VPC\3CX VoIP Phone%fol%\3cxvoipPhone.ini"') do (
set line=%%j
set line=!line:AuthID=%Var3%!
echo.!line!>> "c:\VPC\3CX VoIP Phone%fol%\3cxvoipPhone.new"
)
del "c:\VPC\3CX VoIP Phone%fol%\3cxvoipPhone.ini"
rename "c:\VPC\3CX VoIP Phone%fol%\3cxvoipPhone.new" *.ini
popd
goto :LOOP5
:LOOP5
set Var4=AuthPass=%authp%
@echo off & setlocal EnableDelayedExpansion
for /F "delims=" %%j in ('find /v "" ^< "c:\VPC\3CX VoIP Phone%fol%\3cxvoipPhone.ini"') do (
set line=%%j
set line=!line:AuthPass=%Var4%!
echo.!line!>> "c:\VPC\3CX VoIP Phone%fol%\3cxvoipPhone.new"
)
del "c:\VPC\3CX VoIP Phone%fol%\3cxvoipPhone.ini"
rename "c:\VPC\3CX VoIP Phone%fol%\3cxvoipPhone.new" *.ini
popd
goto :LOOP6
:LOOP6
set Var5=PBXAddr=%serverip%
@echo off & setlocal EnableDelayedExpansion
for /F "delims=" %%j in ('find /v "" ^< "c:\VPC\3CX VoIP Phone%fol%\3cxvoipPhone.ini"') do (
set line=%%j
set line=!line
BXAddr=%Var5%!
echo.!line!>> "c:\VPC\3CX VoIP Phone%fol%\3cxvoipPhone.new"
)
del "c:\VPC\3CX VoIP Phone%fol%\3cxvoipPhone.ini"
rename "c:\VPC\3CX VoIP Phone%fol%\3cxvoipPhone.new" *.ini
popd
goto :LOOP7
:LOOP7
set Var6=LocalPBX=%local%
@echo off & setlocal EnableDelayedExpansion
for /F "delims=" %%j in ('find /v "" ^< "c:\VPC\3CX VoIP Phone%fol%\3cxvoipPhone.ini"') do (
set line=%%j
set line=!line:LocalPBX=%=%Var6%!
echo.!line!>> "c:\VPC\3CX VoIP Phone%fol%\3cxvoipPhone.new"
)
del "c:\VPC\3CX VoIP Phone%fol%\3cxvoipPhone.ini"
rename "c:\VPC\3CX VoIP Phone%fol%\3cxvoipPhone.new" *.ini
popd
goto :LOOP9
:LOOP9
set /A count=%count%+1
set /A fol=%fol%+1
echo.
echo.
echo.
echo.
If %count% lss %copies% goto :CONFIGLOOP
if %count%==%input% goto :SUCCESS
:SUCCESS
echo ==============================================================
echo ==============================================================
echo Congratz, all %copies% Voip Phones are now ready for deployment
echo ==============================================================
echo ==============================================================
exit