Here is sample code to return a collection of Application Pools using WMI and IIS7. This is dynamic because this could be used to retrieve from a local machine or altering the code to connect to a remote server running IIS7. Here is an article that explains...