IIS Server 自动启动停止
IIS Server 实现自动启动停止有4种方法
1.使用net命令
输入 net stop iisadmin /y 回车停止IIS;
再输入 net start iisadmin 回车启动IIS;
再输入 net start w3svc 回车WEB服务
2.使用IISReset命令
3.使用IIS的vbs脚本操作
路径:C:\Inetpub\AdminScripts
4.使用runas命令(推荐)
参考:http://wenku.baidu.com/link?url=f948f68dSMIu4b8ceF34TgCOD6zgvKFK7nnVEuEzshm1h2rf0Vc0STmKBsr0cYqeBu0O-mXQnsLwRMYAqe0CzAaz5fKsZaMPHsu1WdgAW_m
code:
runstop.bat:
echo %date:~0,10% %time% >> D:\Log_iCROPFV4\IISLog\IIS.log
echo "begin to run stop server." >> D:\Log_iCROPFV4\IISLog\IIS.log
rem runas /savecred /user:e-crb\administrator cmd
runas /savecred /user:e-crb\administrator "D:\iCROPFV4\IISServer\IISStop.bat"
rem echo "the IIS server successfully stopped." >> D:\Log_iCROPFV4\IISLog\IIS.log
exit
IISStop.bat
echo "the IIS server is stopping..." >> D:\Log_iCROPFV4\IISLog\IIS.log
cd /d %IIS_Server%
appcmd stop site "iCROPFV4" >> D:\Log_iCROPFV4\IISLog\IIS.log
IISStart.bat
echo "the IIS server is starting..." >> D:\Log_iCROPFV4\IISLog\IIS.log
cd /d %IIS_Server%
appcmd start site "iCROPFV4" >>D:\Log_iCROPFV4\IISLog\IIS.log
注意:配置taskschedual的时候,必须选择配置create basic task
1.使用net命令
输入 net stop iisadmin /y 回车停止IIS;
再输入 net start iisadmin 回车启动IIS;
再输入 net start w3svc 回车WEB服务
2.使用IISReset命令
3.使用IIS的vbs脚本操作
路径:C:\Inetpub\AdminScripts
4.使用runas命令(推荐)
参考:http://wenku.baidu.com/link?url=f948f68dSMIu4b8ceF34TgCOD6zgvKFK7nnVEuEzshm1h2rf0Vc0STmKBsr0cYqeBu0O-mXQnsLwRMYAqe0CzAaz5fKsZaMPHsu1WdgAW_m
code:
runstop.bat:
echo %date:~0,10% %time% >> D:\Log_iCROPFV4\IISLog\IIS.log
echo "begin to run stop server." >> D:\Log_iCROPFV4\IISLog\IIS.log
rem runas /savecred /user:e-crb\administrator cmd
runas /savecred /user:e-crb\administrator "D:\iCROPFV4\IISServer\IISStop.bat"
rem echo "the IIS server successfully stopped." >> D:\Log_iCROPFV4\IISLog\IIS.log
exit
IISStop.bat
echo "the IIS server is stopping..." >> D:\Log_iCROPFV4\IISLog\IIS.log
cd /d %IIS_Server%
appcmd stop site "iCROPFV4" >> D:\Log_iCROPFV4\IISLog\IIS.log
IISStart.bat
echo "the IIS server is starting..." >> D:\Log_iCROPFV4\IISLog\IIS.log
cd /d %IIS_Server%
appcmd start site "iCROPFV4" >>D:\Log_iCROPFV4\IISLog\IIS.log
注意:配置taskschedual的时候,必须选择配置create basic task
版权声明:本文为博主原创文章,未经博主允许不得转载。