0
$wmi = Get-WMIObject -Class Win32_PerfFormattedData_Tcpip_NetworkInterface -ComputerName $computer -Namespace $namespace. 

使用这个 power shell 脚本如何获取参数的值?即我怎样才能得到这些的价值:

  • BytesReceivedPerSec
  • BytesSentPerSec
  • BytesTotalPerSec
4

2 回答 2

0

这还不够吗?

$wmi = Get-WMIObject -Class Win32_PerfFormattedData_Tcpip_NetworkInterface -ComputerName $computer | select Name, BytesReceivedPerSec, BytesSentPerSec, BytesTotalPerSec

您还可以使用 .NET 进行统计总计:

$wmi = [System.Net.NetworkInformation.NetworkInterface]::GetAllNetworkInterfaces() | foreach {$_.name; $_.GetIPv4Statistics()}
于 2012-07-10T08:18:08.460 回答
0
Get-WMIObject -Class Win32_PerfFormattedData_Tcpip_NetworkInterface -ComputerName $computer -Namespace $namespace 
| Select BytesReceivedPerSec, BytesSentPerSec, BytesTotalPerSec
于 2012-07-10T08:17:31.437 回答