这样做的课程似乎是MSFT_NetTransportConnection。
但是我无法通过Get-WmiObject查询此类:
C:\Users\Justin Dearing> Get-WmiObject MSFT_NetTransportConnection
Get-WmiObject : Invalid class "MSFT_NetTransportConnection"
At line:1 char:1
+ Get-WmiObject MSFT_NetTransportConnection
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
C:\Users\Justin Dearing> Get-WmiObject MSFT_NetTransportConnection -Namespace "root/StandardCimv2"
Get-WmiObject : Not supported
At line:1 char:1
+ Get-WmiObject MSFT_NetTransportConnection -Namespace "root/StandardC ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
C:\Users\Justin Dearing> Get-WmiObject MSFT_NetTransportConnection -Namespace "fff"
Get-WmiObject : Invalid namespace "fff"
At line:1 char:1
+ Get-WmiObject MSFT_NetTransportConnection -Namespace "fff"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
我做错了什么?
答案 0 :(得分:3)
我也没有那个WMI / CIM课程。您可能需要确定使用它的名称空间。
您可以使用Get-NetTCPConnection
并在OwningProcess
媒体资源上进行分组,获取每个流程所拥有的网络连接数。
Get-NetTCPConnection -State Established, TimeWait -ErrorAction SilentlyContinue |
Group-Object OwningProcess
答案 1 :(得分:2)
MSFT_NetTcpConnection
班可以合适吗?
Get-WmiObject -Namespace 'ROOT/StandardCimv2' -ClassName MSFT_NetTCPConnection |
Group-Object OwningProcess