Help - Search - Members - Calendar
Full Version: Restart IIS service every 2 hours.
Neowin Forums > Windows Support > Windows NT4/2000/2003/2008 Server
rtano
I've made a bat for restarting IIS and scheduled it to run every 2 hours, (cuz i have to find a solution for an exchange prob, and i use this workaround as temporary solution for the problem)

iisreset.bat
CODE
start iisreset


when the schedule starts it popup a LOT of Cmd windows (20-30 Windows) with the path of the script.


Does anyone have any hint?



BTW
Meery Xmas to all
FuricTrax
These other bat files might be for all the other services that depend on iis?

I have some experience with Exchange. What is the actual problem that you need to keep restarting iis to fix
rtano
the problem is related to the delivering of e-mail in the Lan, restarting IIS (for Smtp) it will deliver the mail succesfully, until i get to fix this problem(it seems that is related with the AV,,,Trend) i have to restart iis .


The problem now is with the number of cmd windows that pops out when the bat is exeute.

Aaron P
Is there a space in the path to the script? Try a path without spaces.
rtano
no space in the script
primortal
if you are running iis 5 take a look at this
http://www.microsoft.com/downloads/details...&DisplayLang=en

for iis 6 try this vb code (just save it as iisrestart.vbs). change '2142295254' to your server name
CODE
strComputer = "."
Set objWMIService = GetObject _
   ("winmgmts:{authenticationLevel=pktPrivacy}\\" _
       & strComputer & "\root\microsoftiisv2")

Set colItems = objWMIService.ExecQuery _
   ("Select * From IIsWebServer Where Name = " & _
       "'W3SVC/2142295254'")

For Each objItem in colItems
   objItem.Start
Next
BudMan
if its the smtp portion that is causing you issues, why not just stop and start the smtp service? Why do you need to reset all of IIS?

net stop servicename
net start servicename

or you could use
sc stop servicename
sc start servicename

Or if your really having issues and the service is hanging, why not just set the service to restart on failure - and then kill it every 2 hours?
rtano
nice ideas....when i return from holidays i will try it.


@primortal......What that vbs will do???
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.