Paste #zA4JXmiu4u

Added By Admin 20:10:29 - 23 Mar 2011

alias -l inout {
  if (!$com(Wbem.2)) { WbemOpen }
  var %BytesReceived $WbemGet(Win32_PerfRawData_Tcpip_NetworkInterface,BytesReceivedPerSec,1)
  %BytesReceived = Received: $bytes($calc(%BytesReceived + $WbemGet(Win32_PerfRawData_Tcpip_NetworkInterface,BytesReceivedPerSec,2))).suf
  var %BytesSent $WbemGet(Win32_PerfRawData_Tcpip_NetworkInterface,BytesSentPerSec,1)
  %BytesSent = Sent: $bytes($calc(%BytesSent + $WbemGet(Win32_PerfRawData_Tcpip_NetworkInterface,BytesSentPerSec,2))).suf
  var %BytesTotal $WbemGet(Win32_PerfRawData_Tcpip_NetworkInterface,BytesTotalPerSec,1)
  %BytesTotal = Total: $bytes($calc(%BytesTotal + $WbemGet(Win32_PerfRawData_Tcpip_NetworkInterface,BytesTotalPerSec,2))).suf
  var %Bandwidth $WbemGet(Win32_PerfRawData_Tcpip_NetworkInterface,CurrentBandwidth,1)
  if ($com(Wbem.2)) { .comclose Wbem.2 }
  return %BytesReceived %BytesSent %BytesTotal 
}
on *:TEXT:@bandwidth:#: {
  /msg $chan $inout
}
alias -l WbemOpen {
  .comopen Wbem.1 WbemScripting.SWbemLocator
  .comclose Wbem.1 $com(Wbem.1,ConnectServer,3,dispatch* Wbem.2)
}
alias -l WbemGet {
  if ($com(Wbem.3)) { .comclose Wbem.3 }
  if ($com(Wbem.2,ExecQuery,3,bstr*,select $2 from $1,dispatch* Wbem.3)) { var %Result $comval(Wbem.3,$3,$2) }
  .comclose Wbem.3 
  return %Result
}


blog comments powered by Disqus