windows 2003下清空IIS的批处理脚本,代码如下:
:) 此脚本用于清空IIS(FTP、网站、应用程序池、用户)
:) 启用Wscript.Shell
regsvr32 /s C:\WINDOWS\System32\wshom.ocx
cscript.exe C:\windows\system32\IISftpdr.vbs /query msftpsvc/1/ROOT|findstr \/>site.txt
:) 删除站点、FTP、用户
for /f %%i in (site.txt) do (
echo %%i
set a=%%i
call set sitename=%%a:~1%%
call echo %%sitename%%
call cscript.exe C:\windows\system32\iisweb.vbs /delete "%%sitename%%"
call cscript.exe C:\windows\system32\IISftpdr.vbs /delete MSFTPSVC/1/ROOT/"%%sitename%%"
call net user "%%sitename%%" /delete
)
cscript.exe C:\Inetpub\AdminScripts/adsutil.vbs ENUM /W3SVC/AppPools |findstr AppPools|findstr /v DefaultAppPool>app.txt
:) 删除应用程序池、用户
for /f %%i in (app.txt) do (
echo %%i
set a=%%i
call set appname=%%a:~17,-1%%
call echo %%appname%%
call cscript.exe C:\Inetpub\AdminScripts/adsutil.vbs DELETE W3SVC/AppPools/%%appname%%
call net user "%%appname%%" /delete
)
:) 关闭Wscript.Shell
regsvr32 /u /s C:\WINDOWS\System32\wshom.ocx
pause
阅读(1644) | 评论(0) | 转发(0) |