IIS Server Application Error的自动修复批处理
用法:将下述代码保存为“1.bat”,双击运行,按提示进行操作,如果没好就一直输N,直到最后。相信可以解决绝大部分此类错误吧。
@echo off
echo *
echo ****************************************************
echo * *
echo * IIS Server Application Error错误自动修复批处理 *
echo * 博客:blog.slogra.com *
echo * *
echo ****************************************************
echo *
echo *
set /p isok0=开始IIS修复?(y/n)
if %isok0%==y goto begin
goto forend
:begin
set userIWAM=IWAM_%COMPUTERNAME%
set userIUSR=IUSR_%COMPUTERNAME%
:checkIWAM
net user %userIWAM%
if %errorlevel%==0 goto checkIUSR
goto netuserIWAM
:checkIUSR
net user %userIUSR%
if %errorlevel%==0 goto edituser
goto netuserIUSR
:netuserIWAM
net user
set /p tiwam=请输入正确的“启动 IIS 进程帐户”名称(即以IWAM_开头的帐户名称)?
set userIWAM=%ans%
goto checkIWAM
:netuserIUSR
net user
set /p tiusr=请输入正确的“Internet 来宾帐户”名称(即以IUSR_开头的帐户名称)?
set userIUSR=%tiusr%
goto checkIUSR
:edituser
echo 重置“启动 IIS 进程帐户”密码为123
net user %userIWAM% 123
echo 重置“Internet 来宾帐户”密码为123
net user %userIUSR% 123
echo 密码同步
cscript.exe %HOMEDRIVE%\Inetpub\Adminscripts\adsutil.vbs set w3svc/wamuserpass 123
cscript.exe %HOMEDRIVE%\Inetpub\Adminscripts\adsutil.vbs set w3svc/anonymoususerpass 123
echo *
echo *
set /p isok1=请测试IIS是否正常?(y/n)
if %isok1%==y goto forend
cscript.exe %HOMEDRIVE%\Inetpub\Adminscripts\synciwam.vbs -v
iisreset
echo *
echo *
set /p isok2=请测试IIS是否正常?(y/n)
if %isok2%==y goto forend
echo 清除MSDTC服务注册表相关信息
reg delete HKLM\SYSTEM\CurrentControlSet\Services\MSDTC /f
reg delete HKLM\SOFTWARE\Microsoft\MSDTC /f
reg delete HKCR\CID /f
echo 停止并重新安装MSDTC服务
net stop msdtc
msdtc -uninstall
msdtc -install
echo 重置“启动 IIS 进程帐户”与“Internet 来宾帐户”密码
net user %userIWAM% 123
net user %userIUSR% 123
echo 同步IIS metabase中IWAM_MYSERVER的密码
%HOMEDRIVE%\Inetpub\Adminscripts\adsutil.vbs set w3svc/wamuserpass "123"
echo 同步COM+应用程序所用的IWAM_MYSERVER密码
cscript.exe %HOMEDRIVE%\Inetpub\Adminscripts\synciwam.vbs -v
echo *
echo *
set /p isok3=请测试IIS是否正常?(y/n)
if %isok3%==y goto forend
echo 重新注册相关组件
rundll32 %windir%\system32\inetsrv\wamreg.dll, CreateIISPackage
regsvr32 %windir%\system32\inetsrv\asptxn.dll /s
echo *
echo *
set /p isok4=请测试IIS是否正常?(y/n)
if %isok4%==y goto forend
echo *
echo *
echo 如果IIS还不正常的话,我真的解决不了唉,请另请高明吧!
:forend
echo *
echo *
@echo 批处理执行完毕,请按任意键退出?
@echo off
pause
echo *
echo ****************************************************
echo * *
echo * IIS Server Application Error错误自动修复批处理 *
echo * 博客:blog.slogra.com *
echo * *
echo ****************************************************
echo *
echo *
set /p isok0=开始IIS修复?(y/n)
if %isok0%==y goto begin
goto forend
:begin
set userIWAM=IWAM_%COMPUTERNAME%
set userIUSR=IUSR_%COMPUTERNAME%
:checkIWAM
net user %userIWAM%
if %errorlevel%==0 goto checkIUSR
goto netuserIWAM
:checkIUSR
net user %userIUSR%
if %errorlevel%==0 goto edituser
goto netuserIUSR
:netuserIWAM
net user
set /p tiwam=请输入正确的“启动 IIS 进程帐户”名称(即以IWAM_开头的帐户名称)?
set userIWAM=%ans%
goto checkIWAM
:netuserIUSR
net user
set /p tiusr=请输入正确的“Internet 来宾帐户”名称(即以IUSR_开头的帐户名称)?
set userIUSR=%tiusr%
goto checkIUSR
:edituser
echo 重置“启动 IIS 进程帐户”密码为123
net user %userIWAM% 123
echo 重置“Internet 来宾帐户”密码为123
net user %userIUSR% 123
echo 密码同步
cscript.exe %HOMEDRIVE%\Inetpub\Adminscripts\adsutil.vbs set w3svc/wamuserpass 123
cscript.exe %HOMEDRIVE%\Inetpub\Adminscripts\adsutil.vbs set w3svc/anonymoususerpass 123
echo *
echo *
set /p isok1=请测试IIS是否正常?(y/n)
if %isok1%==y goto forend
cscript.exe %HOMEDRIVE%\Inetpub\Adminscripts\synciwam.vbs -v
iisreset
echo *
echo *
set /p isok2=请测试IIS是否正常?(y/n)
if %isok2%==y goto forend
echo 清除MSDTC服务注册表相关信息
reg delete HKLM\SYSTEM\CurrentControlSet\Services\MSDTC /f
reg delete HKLM\SOFTWARE\Microsoft\MSDTC /f
reg delete HKCR\CID /f
echo 停止并重新安装MSDTC服务
net stop msdtc
msdtc -uninstall
msdtc -install
echo 重置“启动 IIS 进程帐户”与“Internet 来宾帐户”密码
net user %userIWAM% 123
net user %userIUSR% 123
echo 同步IIS metabase中IWAM_MYSERVER的密码
%HOMEDRIVE%\Inetpub\Adminscripts\adsutil.vbs set w3svc/wamuserpass "123"
echo 同步COM+应用程序所用的IWAM_MYSERVER密码
cscript.exe %HOMEDRIVE%\Inetpub\Adminscripts\synciwam.vbs -v
echo *
echo *
set /p isok3=请测试IIS是否正常?(y/n)
if %isok3%==y goto forend
echo 重新注册相关组件
rundll32 %windir%\system32\inetsrv\wamreg.dll, CreateIISPackage
regsvr32 %windir%\system32\inetsrv\asptxn.dll /s
echo *
echo *
set /p isok4=请测试IIS是否正常?(y/n)
if %isok4%==y goto forend
echo *
echo *
echo 如果IIS还不正常的话,我真的解决不了唉,请另请高明吧!
:forend
echo *
echo *
@echo 批处理执行完毕,请按任意键退出?
@echo off
pause
评论: