Jump to content
Sign in to follow this  
Rich

Scripting the restart of an application pool

Recommended Posts

Rich

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

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
Rich

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

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
Rich

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.

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.