Restart IIS service every 2 hours.


Recommended Posts

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

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

Link to comment
https://www.neowin.net/forum/topic/261514-restart-iis-service-every-2-hours/
Share on other sites

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.

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

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

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?

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Nice devices but my Surface Pro 9 got bricked from a Windows Update efter only three years. Never buying a device from MS again.
    • Icaros Shell Extensions 3.3.6 by Razvan Serea Icaros is a collection of lightweight, high quality, Windows Shell Extensions. Icaros can provide Windows Explorer thumbnails, for essentially any video media format supported by FFmpeg, this includes popular filetypes such as: Mkv, Flv, Avi, Mp4, Mov, Rmvb, M2ts, Ogm etc. Besides the FFmpeg supported filetypes, Icaros also contains custom parsers, which can produce Cover Art thumbnails for Mkv, Flac, Ape, Mpc and several other filetypes. Icaros also provides Windows Explorer properties for the following popular filetypes: Mkv, Mk3d, Mp4, Mov, Webm, Ogm, Ogg, Flv, Avi, Rm, Rmvb, Flac, Opus, Spx, Ape, Mp3, Mpc, Mka, Tak, Tta, Ofr, Wav and more. Properties refer to the info shown for each file in Explorer, such as length, width, height, title, channels and so on. Icaros works on Vista, Windows 7, Windows 8/8.1, Windows 10 and Windows 11. Icaros Shell Extensions 3.3.6 changelog: Added support for Animated WEBP thumbnailing Added support for UTF-8 filenames in CBX files (Comic book files) Added support for rotation of MKV thumbnails Added support for "Sort title" property in MKV files Fixed some wav files not showing properties Fixed some old h264 files producing green thumbnails Fixed default level of MKV tags (now set to 50) Updated FFmpeg Download: Icaros Shell Extensions 3.3.6 | 12.8 MB (Freeware) Download: Portable Icaros 3.3.6 View: Icaros Shell Extension Home Page | Screenshots 1 | 2 Get alerted to all of our Software updates on Twitter at @NeowinSoftware
  • Recent Achievements

    • Week One Done
      Huge Trailer earned a badge
      Week One Done
    • Week One Done
      Classifyskilleducation earned a badge
      Week One Done
    • One Month Later
      eurospharma62 earned a badge
      One Month Later
    • Week One Done
      With What earned a badge
      Week One Done
    • Week One Done
      Harris Gilbert earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      535
    2. 2
      +Edouard
      167
    3. 3
      PsYcHoKiLLa
      70
    4. 4
      neufuse
      64
    5. 5
      ATLien_0
      63
  • Tell a friend

    Love Neowin? Tell a friend!