使用 Powershell 的进程的网络使用 [英] Network Usage of Process Using Powershell

查看:50
本文介绍了使用 Powershell 的进程的网络使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想计算特定进程发送和接收的字节数.我想为此使用powershell.我可以使用 Resource Monitor->Network Activity 做的事情.我如何使用 get-counter 来做到这一点?

I want to calculate the bytes sent and recieved by a particular process .I want to use powershell for that. Something which I can do using Resource Monitor->Network Activity. How can i do that using get-counter?

推荐答案

这里有一篇关于使用 Get-Counter cmdlet 的非常好的脚本专家文章:

There is a really good Scripting Guy article on using the Get-Counter cmdlet here:

Scripting Guy - Get-Counter

诀窍是找到您需要的计数器,我认为您无法获得所需的粒度,因为这些计数器与 PerfMon 使用的计数器相同.它更关注整个网络接口,而不是使用接口的单个​​进程.话虽如此,如果它是唯一使用给定接口的东西,它应该能很好地完成任务.

The trick will be finding the counter that you need, and I don't think you can get the granularity you're after as these are the same counters that PerfMon uses. It's more focused around the whole Network Interface than it is around the individual processes using the interface. With that said, if it's the only thing using the given interface it should do the trick nicely.

先看看可用的网络接口选项:

Have a look at the Network Interface options available for a start:

(get-counter -list "Network Interface").paths

这篇关于使用 Powershell 的进程的网络使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆