SCOM - Recovery task IIS application pool

Kam Wai Chan 216 Reputation points
2022-11-01T18:26:20.153+00:00

Hi,

I am wondering how to setup a recovery task on SCOM to restart/start the application pool?

When IIS 10 Application Pool MP detect "Application Pool disabled due to worker process failure".

Please advise.

Thank you!

JC

Operations Manager
Operations Manager
A family of System Center products that provide infrastructure monitoring, help ensure the predictable performance and availability of vital applications, and offer comprehensive monitoring for datacenters and cloud, both private and public.
1,417 questions
0 comments No comments
{count} votes

Accepted answer
  1. SChalakov 10,261 Reputation points MVP
    2022-11-09T14:03:14.717+00:00

    Hi @Kam Wai Chan ,

    this is so cool, I am glad that you could resolve it with the ID. Please mark your answer as a solution, so that this post can help other with the same request!
    And of course, thanks for sharing!

    Regards,
    Stoyan

    0 comments No comments

5 additional answers

Sort by: Most helpful
  1. Kam Wai Chan 216 Reputation points
    2022-11-09T13:51:10.31+00:00

    258739-image.png

    I found the solution.

    Full path to file:
    %windir%\System32\inetsrv\AppCmd.exe

    Parameters:
    start apppool /apppool.name:$Target/Property[Type="MicrosoftWindowsInternetInformationServicesCommonLibrary10101!Microsoft.Windows.InternetInformationServices.ApplicationPool"]/PoolID$

    Thank you!

    1 person found this answer helpful.
    0 comments No comments

  2. SChalakov 10,261 Reputation points MVP
    2022-11-02T07:46:41.803+00:00

    Hi JC,

    the process is prettyy straight forward and is depicted here:

    SCOM Basics: Creating a Service Monitor with Automatic Recovery
    https://www.opsman.co.za/scom-basics-creating-a-service-monitor-with-automatic-recovery/

    In this article, the first part covers the creation of a monitor, but you can skip this and go directly to the section:

    "Creating an automatic start service recovery:"

    You can follwo the steps there, but when you get to the part where you need to configure the full path to file (c:\windows\System32\net.exe on the example) you don't enter "c:\windows\System32\net.exe", but you enter:

    c:\windows\System32\inetsrv\AppCmd.exe

    becuase you will be using executing a bit different command with the IIS tool Appcmd.exe. An example of how it should look like, from:

    Afterwards you need to enter the command for starting the pool under parameters. The command should look like this, from:

    How to restart the IIS application pool from the command line?
    https://bobcares.com/blog/how-to-restart-iis-application-pool-command-line/

    start apppool /apppool.name: abc  
    

    please be aware that the actual command is like:

    appcmd start apppool /apppool.name: abc  
    

    but because you already specified the path to the appcmd.exe, you need to skip the "apcmd" part and enter the rest ("start apppool /apppool.name: abc") in the "Parameters" field.

    This will do the job, I hope I could help you out!

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
    Regards
    Stoyan Chalakov


  3. SChalakov 10,261 Reputation points MVP
    2022-11-02T13:34:01.29+00:00

    Hi @Kam Wai Chan ,

    unfortunately not, you have to use the Application Pool name with the command, other parameters will not work :(

    Hier you can find a nice exacmple, posted by Leon:
    restart Application Pool using Diagnostic task in SCOM
    https://social.technet.microsoft.com/Forums/systemcenter/en-US/267f26fc-e3b7-41b2-ac20-2894ed91a36c/restart-application-pool-using-diagnostic-task-in-scom?forum=operationsmanagergeneral

    But I think I understand now where the challenge is: You need to have a way to dynamically obtain the name of the IIS Application pool, which has been disabled.
    Unnder the same link, you will find also the suggestiions of CyrAz (@CyrAz ), who is also active in this forum, where he shared his thoughtson accomplishing this same taks in an automated way.
    So if you have a specific Application pool in mind, you can just use the command above with the IIS App Pool name, but if you want to auotmate it, it will get complex.

    Regards,
    Stoyan

    0 comments No comments

  4. SChalakov 10,261 Reputation points MVP
    2022-11-02T13:39:01.813+00:00

    Hi @Kam Wai Chan ,

    i think I found it:

    Recovering an IIS Application Pool using SCOM 2012 R2
    https://vimeo.com/92720005

    It does not matter that it says SCOM 2012 R2, the approch is the same and you have to use:

    256443-image.png

    Althought on the example they are using wmic (WMI query), you can use apcm.exe and try with the DisplayName and let me know if it works.

    Regards,
    Stoyan