windows 2003 一键安装iis6.0

admin2016-09-22windows106
@echo IIS6 Setup Start!!!
@echo off
rem 检测服务
set tempfile=%temp%\queryserver.txt
net start>%tempfile%
echo %tempfile%

echo 检测服务
Set sSvr=   IIS Admin Service
for /f "delims=: tokens=*" %%i in (%tempfile%) do (
  if "%sSvr%"=="%%i" (
  echo %%i 服务已启动 
  goto :end
  )
)

echo 检测服务
Set sSvr=   Remote Procedure Call (RPC)
for /f "delims=: tokens=*" %%i in (%tempfile%) do (
 if "%sSvr%"=="%%i" (echo %%i 服务已启动 
 set sSvr=)
)
if "%sSvr%"=="   Remote Procedure Call (RPC)" (
echo "启动服务Remote Procedure Call (RPC)"
net start RpcSs
)

echo 检测服务
Set sSvr=   Security Accounts Manager
for /f "delims=: tokens=*" %%i in (%tempfile%) do (
 if "%sSvr%"=="%%i" (echo %%i 服务已启动 
 set sSvr=)
)
if "%sSvr%"=="   Security Accounts Manager" (
echo Security Accounts Manager
net start Samss
)

setlocal enabledelayedexpansion
set setupath=%cd%
set setupath=!setupath:\=\\!
>>%temp%\iis.reg echo Windows Registry Editor Version 5.00 
>>%temp%\iis.reg echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup]    
>>%temp%\iis.reg echo "ServicePackSourcePath"="%setupath%\\"
>>%temp%\iis.reg echo "SourcePath"="%setupath%\\"

rem BackupFile
regedit /e "%temp%\DConfig.Reg" HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup

regedit -s %temp%\iis.reg  
set "r=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup"
::将%cd%与%WINDIR%分组添加到注册表中,键名:Installation Sources
reg delete "%r%" /v "Installation Sources" /f
reg add "%r%" /v "Installation Sources" /t REG_MULTI_SZ /s # /d "%cd%\i386#%WINDIR%" /f 
@del %temp%\iis.reg /q/f 

>>%temp%\iis.txt echo [Components] 
>>%temp%\iis.txt echo iis = on 
>>%temp%\iis.txt echo iis_common=on
>>%temp%\iis.txt echo iis_inetmgr=on
>>%temp%\iis.txt echo iis_www_parent=on
>>%temp%\iis.txt echo iis_www=on
>>%temp%\iis.txt echo iis_ftp=off
>>%temp%\iis.txt echo sakit_web=on
>>%temp%\iis.txt echo appsrv=on
>>%temp%\iis.txt echo appsrv_console=on
>>%temp%\iis.txt echo complusnetwork=on
>>%temp%\iis.txt echo dtcnetwork=on
>>%temp%\iis.txt echo IIS_ASP=on
>>%temp%\iis.txt echo IIS_InternetDataConnector=on
>>%temp%\iis.txt echo IIS_ServerSideIncludes=on
>>%temp%\iis.txt echo IIS_WebDav=on

sysocmgr /i:%windir%\inf\sysoc.inf /u:%temp%\iis.txt /x
@del %temp%\iis.txt /q/f

rem RestoreFile
regedit /s "%temp%\DConfig.Reg"
@del "%temp%\DConfig.Reg" /q/f 

:end
iisext /enapp "Active Server Pages"
@echo IIS6 Setup Finish!!!
http://pan.baidu.com/s/1i4UwA8H