I currently have this batch file that allow me create an Application and Application Pool in IIS. it works, but it only creates just one Application and Application Pool.
this is my current script:
@echo ON
setlocal enabledelayedexpansion
REM "Content Source path"
set arg1=%1
REM "Content destination path"
set arg2=%2
REM "apps to setup"
set arg3=%3
REM Split virt names and loop through it.
FOR /F "tokens=1* delims=," %%a in (%arg3%) do (
set vir=%%a
set pool=!vir!!poolname!
REM CREATE APPLICATION
%systemroot%\system32\inetsrv\APPCMD add app /site.name:"Default Web Site" /path:/!vir! /physicalpath:"%arg2%"
REM CREATE APP POOL
%systemroot%\system32\inetsrv\appcmd add apppool /name:!pool! /managedPipelineMode:Integrated /processModel.identityType:ApplicationPoolIdentity /enable32BitAppOnWin64:false
REM ASSIGN APP POOL TO APPLICATION
%systemroot%\system32\inetsrv\appcmd set app /app.name:"Default Web Site/!vir!" /applicationPool:!pool!
):END Endlocal
install.bat "c:\source" "c:\target" "APP1,APP2,APP3"
Please can someone tell me what I'm doing wrong.
Thanks.