Is there an easy way (via a script perhaps) to get the cumulative bytes sent and received from a NIC on Windows Server 2008?
For example, the NIC currently shows around 18 MB of sent data and 765 MB of received data.
Since my server provider does not provide an easy way to see the monthly bandwidth usage, getting the NIC data seems to be the most reliable one.
I know I can use PRTG to get the current usage data via SNMP, but it will only be an average since the sensor checks every 60 seconds.
In PowerShell (CTP2v3), the commands below will help. (I have three interfaces). However, once the NIC was restarted, this information will zero out.
$computer = "LocalHost";
$namespace = "root\CIMV2";
$Tcpip_NI = Get-WmiObject -class Win32_PerfRawData_Tcpip_NetworkInterface -computername $computer -namespace $namespace;
$Tcpip_NI | Select BytesReceivedPersec, BytesSentPersec, BytesTotalPersec;
$netsh_interface_stats = netsh interface ip show interface;
$netsh_interface_stats | Select-string "In Octets";
$netsh_interface_stats | Select-string "Out Octets";