Created
July 25, 2015 18:10
-
-
Save michaellwest/27fada34020ae39e0614 to your computer and use it in GitHub Desktop.
The following lists all application pools in IIS and matches with their associated w3wp.exe process id.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module -Name WebAdministration | |
$appPoolsPath = "IIS:\AppPools" | |
foreach($appPool in Get-ChildItem -Path $appPoolsPath) { | |
if($appPool.state -eq "Started") { | |
$processes = Get-ChildItem -Path "$($appPoolsPath)\$($appPool.Name)\WorkerProcesses" | |
foreach($process in $processes) { | |
[pscustomobject]@{ | |
"AppPool" = $appPool.Name | |
"ProcessId" = $process.ProcessId | |
"State" = $process.State | |
"StartTime" = $process.StartTime | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment