【发布时间】:2017-04-03 20:17:29
【问题描述】:
问题定义:我们已经在我们的 Web 服务器中进行了一些配置级别的更改,该服务器基本上是一个 IIS 服务器。我们将线程数从默认的 300 增加到了大约 450。
而且这些更改可能会使我们的服务器崩溃。
所以我们想监控工作线程,并定期将其记录到数据库中。
我目前的进展:
到目前为止,我能够通过下面提到的 Powershell 命令运行一个 exe 来获取详细信息。
(只需将 w3wp.exe 替换为任何进程名称即可获得结果)
$name = "w3wp.exe"
$processHandle = (Get-CimInstance Win32_Process -Filter "Name = '$name'").ProcessId
$Threads = Get-CimInstance -Class Win32_Thread -Filter "ProcessHandle = $processHandle"
$threads | Select-Object priority, thread*, User*Time, kernel*Time |
Out-GridView -Title "The $name process has $($threads.count) threads"
问题:在上面提到的 PowerShell 脚本中,当 w3wp.exe 使用多个 PID 运行时,它无法为我提供 exe 的结果。
有没有办法让我们获得多个运行的 exe 的结果?
表格应该是
处理器名称| PID|工人姓名|线程数|
【问题讨论】:
标签: windows powershell