How Can I Monitor an IIS 7.5 Application Pool with WMI?

view story

http://serverfault.com – I currently have an application in a load balanced IIS cluster (NLB) on Server 2008 R2. This application leverages some legacy database access code which occasionally fails enough to disable the app pool. I would like put a WMI event watcher in place to monitor the change in the status of the app pool (other suggestions welcome), that would restart the app pool if it goes into a stopped state. This is for a temporary workaround until new code can be pushed, but that has to go through a Dev/QA/UAT cycle. There is a WMI class for the ApplicationPool in the root\webadministration namespace (HowTos)