Jump to content

Scripting the restart of an application pool


Recommended Posts

Is there any way to restart an application pool in IIS using AutoIT? I've already made a script that will check to see if the site is up, and then email me if it fails. I'd like to add the function of restarting the app pool when it fails as well. Any help would be appreciated

Link to comment
Share on other sites

Is there any way to restart an application pool in IIS using AutoIT? I've already made a script that will check to see if the site is up, and then email me if it fails. I'd like to add the function of restarting the app pool when it fails as well. Any help would be appreciated

IIS6:
Global $oAppPool = ObjGet("IIS://localhost/W3SVC/AppPools/DefaultAppPool")

$oAppPool.Stop()
Sleep(15000)
$oAppPool.Start()

:P

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Fantastic! One more thing... Do you know of a way to check the status of the app pool? I've been searching all over the forums and can't find any info on this at all.

The script I have that checks the site will get data back ("Service Unavailable") if the app pool is dead, so it assumes the site is still up. Thanks again for the restart code, that helps a TON

Link to comment
Share on other sites

Fantastic! One more thing... Do you know of a way to check the status of the app pool? I've been searching all over the forums and can't find any info on this at all.

The script I have that checks the site will get data back ("Service Unavailable") if the app pool is dead, so it assumes the site is still up. Thanks again for the restart code, that helps a TON

Just Google up the equivalent VBScript to do it and convert to AutoIt.

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

I'm still looking for a good way to check the application pool status. In the meantime, if the script could check for the word "Unavailable" in the body, that would be sufficient. I think _INetGetSource might be a good way to go about this, but not sure about the parameters needed.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...