Search code examples
windowsperlbandwidth

perl on win2003 (strawberry perl) - how to get current bandwidth usage?


Title pretty much tells everything. Is it possible to get current bandwidth usage in windows2003 via a perl script (using strawberry perl) ?


Solution

  • I rarely use Windows, and don't currently have access to a Windows machine, but you should be able to use WMI/WQL to get what you need.

    This distribution provides a DBI interface to WMI:

    https://metacpan.org/release/DBD-WMI

    The correct query would be along the lines of

    Select Name, currentbandwidth
      FROM Win32_PerfFormattedData_Tcpip_NetworkInterface
    

    More about that class from MSDN.