Created
December 8, 2023 00:55
-
-
Save jamiegs/5e3869f26830d2faf4b1e81cdaaf1572 to your computer and use it in GitHub Desktop.
Maps the w3p#n to the name of the app pool.
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
$count = (Get-Process | Where-Object { $_.Name -eq 'w3wp' }).count -1 | |
$var = 1 | |
$result = '' | |
$id = (Get-Counter "\Process(w3wp)\ID Process").CounterSamples.CookedValue | |
$app = [regex]::match((Get-CimInstance Win32_Process -Filter "ProcessId = $id").CommandLine, '"([^"]+)"').Groups[1].Value | |
$result += "w3wp = $id, $app`n" | |
while ($var -le $count) { | |
$id = (Get-Counter "\Process(w3wp#$var)\ID Process").CounterSamples.CookedValue | |
$app = [regex]::match((Get-CimInstance Win32_Process -Filter "ProcessId = $id").CommandLine, '"([^"]+)"').Groups[1].Value | |
$result += "w3wp#$var = $id, $app`n" | |
$var += 1 | |
} | |
$result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment