Powershell – Programmatically retrieve Application Pool Defaults

application-poolsiis-7powershell

Using the IIS namespace, one can query the IIS Apppool settings, using:


$pools = get-wmiobject -namespace "root/microsoftiisv2" -query 'select * from IIsApplicationPoolSetting'

However, this only returns information about the existing application pools.

How can one query the current application pool defaults, the same that are retrieved from Application Pools > Set Application Pool Defaults. These values are different from the Default Application Pool (DefaultAppPool)

Best Answer

The following should get you started:

import-module webadministration
Get-WebConfiguration /system.applicationHost/applicationPools/applicationPoolDefaults