Quick reference for listing the sites and application pools configured on an IIS server from PowerShell — useful for server inventories, migration planning, and “why is this pool set to AlwaysRunning?” archaeology. The original 2018 one-liner still works; the modern IISAdministration module is below it.
The classic WebAdministration way
Import-Module WebAdministration
dir IIS:\Sites # Lists all sites
dir IIS:\AppPools # Lists all app pools and applications
# List all sites, applications and appPools
dir IIS:\Sites | ForEach-Object {
# Web site name
$_.Name
# Site's app pool
$_.applicationPool
# Any web applications on the site + their app pools
Get-WebApplication -Site $_.Name
}
The IIS: drive and cmdlets above come from the WebAdministration module. It still ships with IIS and remains fine for quick inspections.
The modern way: IISAdministration (IIS 10+)
Since IIS 10, the recommended module is IISAdministration. Instead of driving through the IIS: provider, it returns objects that pipeline cleanly:
Import-Module IISAdministration # All application pools - default view shows name, state, CLR version, pipeline mode Get-IISAppPool # Just the state of one pool (Get-IISAppPool "DefaultAppPool").State # Recycle it when needed (Get-IISAppPool "DefaultAppPool").Recycle()
For the site-to-pool mapping, WebAdministration’s Get-Website and Get-WebApplication are still the quickest route:
Import-Module WebAdministration # Site name, state and its application pool Get-Website | Select-Object Name, State, applicationPool # Web applications under a specific site, with their pools Get-WebApplication -Site "Default Web Site" | Select-Object path, applicationPool
Which module should you use?
- WebAdministration — IIS 7.5+, provider-based (
IIS:drive), available everywhere, good for ad-hoc queries. - IISAdministration — IIS 10+, object-based, pipeline-friendly, officially recommended for new scripts.
Both modules require the IIS Management Scripts and Tools feature and an elevated session on the server (or a remoting session to it). Cmdlet references: Get-IISAppPool, WebAdministration module, IISAdministration module.