If you have an application pool name and you can therefore retrieve this application pool is there any way to retrieve the applications or sites associated with this application pool programmatically? I would settle for just getting a number to basically identify if the application pool is being used but it would be nice to also be able to identify the name of the application / site that is using it as well if possible.
I came across this question but it seems to do it by looping through the existing applications. It doesn't address sites, though that shouldn't be tricky as I can use site.ApplicationDefaults.ApplicationPoolName. However, is there a 'clean' way of getting a collection of applications / sites if you have the app pool name?