How to obtain IP Address from Win32_PerfRawData_Tcpip_NetworkInterface Powershell and average system throughput?

Viewed 34

I noticed that under in the Status window for a network interface in Network and Sharing Center, it shows how many bytes have been sent and received, as well as the duration.

By knowing the duration, I can calculate the average bandwidth used by the system.

Also, since I am using Windows 10, I can go to Network & Internet and in the Status tab it lists the data usage over the past 30 days. This is less ideal since it doesn't seem to differentiate between upload and download.

I would like to know the average throughput of several Windows 10 systems by using a Powershell script to automatically obtain those values. How can I do this?

The command:

Get-NetAdapterStatistics

returns the number of bytes sent and received, but duration is not there, so I can't calculate the average rate.

The command:

$Tcpip_NI = Get-WmiObject -class Win32_PerfRawData_Tcpip_NetworkInterface -computername "LocalHost"
$Tcpip_NI | Select BytesReceivedPersec, BytesSentPersec, BytesTotalPersec, Name;

returns additional information which seems to be about throughput.

Edit I'm pretty sure these don't return the values I'm after, at least on my system. I got like 3.3 Gbps when my internet connection at most is 100Mbps. I'm pretty sure LAN traffic is included in this value, but still, I would not reach a continuous average of 3.3 Gbps on my system. Anyways, just realized this, but I'll leave what I have below.

However, I would need to know the IP address of each of the interfaces, associated with the Names.

I tried using the following command but the InterfaceAlias is different from the Names listed from the above command. So I cannot make the correlation between the output of the above command and below command in terms of name and IP address.

Get-NetIPAddress |Select IPAddress, InterfaceAlias

Okay, I'll test in a moment, but I think this command should show the correlation between Name and InterfaceDescription:

Get-NetAdapter
0 Answers
Related