1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| $wp = Get-WmiObject WorkerProcess -Namespace root/WebAdministration
foreach($w in $wp){
$w | Invoke-WmiMethod -Name GetExecutingRequests |
Select-Object -ExpandProperty OutputElement | Foreach-Object{
[PSCustomObject]@{
nomePool = $w.AppPoolName
PID = $w.ProcessId
ipOrigem = $_.ClientIPAddress
modulo = $_.CurrentModule
idConexao = $_.ConnectionId
porta = $_.LocalPort
siteId = $_.SiteId
url = $_.Url
verbo = $_.Verb
tempoEmSegundos = $_.TimeInState / 1000
}
}
} |
$wp = Get-WmiObject WorkerProcess -Namespace root/WebAdministration
foreach($w in $wp){
$w | Invoke-WmiMethod -Name GetExecutingRequests |
Select-Object -ExpandProperty OutputElement | Foreach-Object{
[PSCustomObject]@{
nomePool = $w.AppPoolName
PID = $w.ProcessId
ipOrigem = $_.ClientIPAddress
modulo = $_.CurrentModule
idConexao = $_.ConnectionId
porta = $_.LocalPort
siteId = $_.SiteId
url = $_.Url
verbo = $_.Verb
tempoEmSegundos = $_.TimeInState / 1000
}
}
}
É possível filtrar para um determinado PID ou pool de aplicativo, por exemplo, alterando a primeira linha para alguma coisa do tipo
1
| $wp = Get-WmiObject WorkerProcess -Namespace root/WebAdministration -Filter "ProcessId=%PID%" |
$wp = Get-WmiObject WorkerProcess -Namespace root/WebAdministration -Filter "ProcessId=%PID%"
1
| $wp = Get-WmiObject WorkerProcess -Namespace root/WebAdministration -Filter "AppPoolName='%nomeDaPool%'" |
$wp = Get-WmiObject WorkerProcess -Namespace root/WebAdministration -Filter "AppPoolName='%nomeDaPool%'"
Referência: Get requests that are currently executing in a worker process