# encoding: ascii
# api: powershell
# title: Get Network Utilization
# description: replace $inst with your NIC name. You can find that out by running (new-object System.Diagnostics.PerformanceCounterCategory(“network interface”)).GetInstanceNames()
# version: 0.1
# author: halr9000
# license: CC0
# x-poshcode-id: 1349
# x-archived: 2016-10-24T04:58:46
# x-published: 2009-09-29T11:36:00
#
#
$cnt = 'Bytes Total/sec'
$inst = 'Broadcom NetXtreme Gigabit Ethernet - Packet Scheduler Miniport'
$cat = 'Network Interface'
$cnt2 = 'Current Bandwidth'
$cur = New-Object system.Diagnostics.PerformanceCounter($cat,$cnt,$inst)
$max = New-Object system.Diagnostics.PerformanceCounter($cat,$cnt2,$inst)
$curnum = $cur.NextValue()
$maxnum = $max.NextValue()
$util = (( $curnum * 8 ) / $maxnum ) * 100
$util
