如何使用 PowerShell 根据进程名称对进程进行分组?


你可以根据进程的属性对进程进行分组。此处,我们将根据进程的名称对进程进行分组,这将显示该进程正在运行的实例数。对于它,**Group-Object** 命令非常有用。

命令

下面的命令将对对象进行分组,并根据其线程数对对象进行排序。

Get-Process |Group-Object Name | Select Name, Count |Sort-Object count - Descending

输出

Name                                                           Count
----                                                           -----
svchost                                                           91
chrome                                                            34
RuntimeBroker                                                     11
conhost                                                            6
Code                                                               6
WmiPrvSE                                                           6
dllhost                                                            4
RAVBg64                                                            4
powershell                                                         3
csrss                                                              2
fontdrvhost                                                        2
AcroRd32                                                           2
taskhostw                                                          2
SkypeBridge                                                        1
smartscreen                                                        1
smss                                                               1
sihost                                                             1
SkypeApp                                                           1
SkypeBackgroundHost                                                1
sppsvc                                                             1
StartMenuExperienceHost                                            1

更新时间:2020 年 1 月 22 日

332 次浏览

开启你的职业生涯

通过完成课程获得认证

入门
广告
© . All rights reserved.