IIS應用程序池自動回收作業
阿新 • • 發佈:2017-12-30
post 計劃 amp set 任務計劃 system for object obj
vb:
appPoolName = WScript.Arguments(0) Set oWebAdmin = GetObject("winmgmts:root\WebAdministration") Set oAppPool = oWebAdmin.Get("ApplicationPool.Name=‘" + appPoolName + "‘") oAppPool.Recycle set fso=createobject("scripting.filesystemobject") if (fso.fileexists("C:\WebRoot\WebSite\FLFTask\Logs\recycleIISPool.log")) then ‘1-forreading,2-forwriting,8-appending set file=fso.opentextfile("C:\WebRoot\WebSite\FLFTask\Logs\recycleIISPool.log",8,ture) else set file=fso.createtextfile( "C:\WebRoot\WebSite\FLFTask\Logs\recycleIISPool.log",8,ture) end if ‘write(x)寫入x個字符,writeline寫入換行,writeblanklines(n)寫入N個空行file.writeline now&" 應用程序池“"&appPoolName &"”已經回收成功。" file.close
並寫bat
cscript recyclepool.vbs EduWebApi
並放入任務計劃程序中 執行Bat
IIS應用程序池自動回收作業