@echo off
@echo BEGIN MyApp INSTALL AT %DATE% %TIME% > install-log.txt
SET /P UserName="Enter Network User Number for MyApp Application Identity: "
SET /P Password="Enter Password for this UA: "
@echo Copying Files
@echo Copying Files >> install-log.txt
XCOPY /E /I /Q /H /R /Y php C:\php >> install-log.txt
XCOPY /E /I /H /R /Y MyApp "C:\inetpub\MyApp" >> install-log.txt
@echo Installing x86 C Runtime
@echo Installing x86 C Runtime >> install-log.txt
vcredist_x86.exe /q >> install-log.txt
@echo Installing x64 C Runtime
@echo Installing x64 C Runtime >> install-log.txt
vcredist_x64.exe /q >> install-log.txt
@echo Installing SQL Native Client
@echo Installing SQL Native Client >> install-log.txt
msiexec /i sqlnclix64.msi /q IACCEPTSQLNCLILICENSETERMS=YES
msiexec /i sqlnclix86.msi /q IACCEPTSQLNCLILICENSETERMS=YES
@echo Configuring Web Server
@echo Configuring Web Server >> install-log.txt
@echo Setting up FastCGI >> install-log.txt
%windir%\system32\inetsrv\appcmd.exe set config /section:system.webServer/fastCGI /+[fullPath='c:\php\php-cgi.exe'] >> install-log.txt
%windir%\system32\inetsrv\appcmd.exe set config /section:system.webServer/handlers /+[name='PHP_via_FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='c:\php\php-cgi.exe',resourceType='Either'] >> install-log.txt
%windir%\system32\inetsrv\appcmd.exe set config /section:system.webServer/fastCgi /[fullPath='c:\php\php-cgi.exe'].instanceMaxRequests:10000 >> install-log.txt
%windir%\system32\inetsrv\appcmd.exe set config /section:system.webServer/fastCgi /+"[fullPath='C:\php\php-cgi.exe'].environmentVariables.[name='PHP_FCGI_MAX_REQUESTS',value='10000']" >> install-log.txt
@echo Creating Application Pool >> install-log.txt
%windir%\system32\inetsrv\appcmd.exe set config /section:system.applicationHost/applicationPools /+"[name='MyApp',autoStart='True',managedPipelineMode='Integrated']" /commit:apphost >> install-log.txt
%windir%\system32\inetsrv\appcmd.exe set config /section:applicationPools /[name='MyApp'].processModel.identityType:SpecificUser /[name='MyApp'].processModel.userName:%UserName% /[name='MyApp'].processModel.password:%Password% >> install-log.txt
@echo Creating MyApp Site >> install-log.txt
%windir%\system32\inetsrv\appcmd.exe stop SITE "Default Web Site" >> install-log.txt
%windir%\system32\inetsrv\appcmd.exe delete SITE "MyApp" >> install-log.txt
%windir%\system32\inetsrv\appcmd.exe add SITE /name:MyApp /id:100 /bindings:http/*:80: /physicalPath:c:\inetpub\MyApp >> install-log.txt
%windir%\system32\inetsrv\appcmd.exe set site /site.name:MyApp /applicationDefaults.applicationPool:MyApp >> install-log.txt
%windir%\system32\inetsrv\appcmd.exe start SITE "MyApp" >> install-log.txt
@echo Setting Default Document >> install-log.txt
%windir%\system32\inetsrv\appcmd.exe set config /section:system.webServer/defaultDocument /~files /commit:apphost >> install-log.txt
%windir%\system32\inetsrv\appcmd.exe set config /section:system.webServer/defaultDocument /+"files.[value='index.php']" /commit:apphost >> install-log.txt