Learn how to extend the functionality of the popular network performance measurement and tuning tool iPerf with the help of PowerShell.

Adam Bertram

Adam Bertram is a 20-year IT veteran, Microsoft MVP, blogger, and trainer. Adam is the founder of the e-learning tech screencast platform TechSnips. Catch up on Adam’s articles at adamtheautomator.com, or follow TechSnips on Twitter at @techsnips_io.

The network monitoring space is enormous. Many different network products and vendors out there do some fancy things. But those fancy things come with a hefty price tag. What if you want a tool you and your small team can use to test network performance occasionally? One way is to use the old-school iPerf network utility and PowerShell.

iPerf is small .exe that allows you to send and receive test network traffic to and from endpoints to test throughput. It works well, but it's not the most straightforward syntax to understand. On top of that, iPerf just does one thing: it tests bandwidth between two endpoints. It'd be nice if, instead of only using generic endpoints, we could define our own WAN sites and servers at those sites. We could add another feature to schedule this performance test too.

We can't add additional features to iPerf itself, but we can wrap some PowerShell around it to create a useful network monitoring tool for free!

We don't have to build our own PowerShell code to do this. I've already created a PowerShell module we can use called iPerfAutomate. This module is available for download from the PowerShell Gallery by running Install-Module iPerfAutomate. This module only makes two functions available to you: New-iPerfSchedule and Start-iPerfMonitorTest.

The iPerfAutomate PowerShell module extends iPerf's functionality by both providing a concept of a "site" and also allowing us to schedule these tests via the New-iPerfSchedule command efficiently. This module lets you measure network performance between two hosts (default iPerf behavior) and two WAN sites (new functionality in iPerfAutomate).

To demonstrate a simple test with iPerfAutomate, let's build out an example network topology. When you open up the iPerfAutomate.psm1 file, you'll see a hash table called $SiteServerMap. This hash table "maps" a named site of yours to a particular host at that site. For example, if you had a Chicago site with a server called CHISRV and a site in Tokyo called TOKSRV, it would represent them like this:

After doing the site-to-host mapping, we can now perform ad-hoc tests between the two locations. Perhaps I want to test my link between Chicago to Tokyo. To do this, I need to run the Start-IPerfMonitorTest command, setting the FromSite parameter argument Chicago and the ToSite parameter to Tokyo as shown below. I've decided to use the Verbose parameter since it will display the various steps the iPerfAutomate module goes through to make this test happen.

When I run this command, you can get a glimpse as to what's going on. The command first copies the iPerfAutomate module to the remote hosts at both sites. This transfer happens because the iPerf utility must set up a sender and receiver. The iPerfAutomate module sets up both a sender and receiver in the background. It then starts up the "server" or receiver, runs the iPerf utility test to set up communication between the two hosts, and initiates the test.

You can also spot the -w 712KB. This is an argument passed to the iPerf utility by default, which indicates the file size it will transfer. You can change this size by using the FileSize parameter on the Start-IPerfMonitorTest command.

Testing network performance

Testing network performance

You could have done all of these steps using the iPerf utility and some PowerShell code on your own, but the beauty of the iPerfAutomate module is that you don't have to worry about all of this. It just gets down to the problem you'd like to solve, which is testing network performance between sites.

Using iPerf and PowerShell with the iPerfAutomate module is a quick and free way to test network performance across two sites or even just two hosts. iPerfAutomate extends the iPerf's functionality not available by default, creating a handy tool for network administrators!

Join the 4sysops PowerShell group!

Your question was not answered? Ask in the forum!

6+

Users who have LIKED this post:

  • avatar
  • avatar
  • avatar
Share
3 Comments
  1. Soren 5 months ago

    Hi Adam

    I have found this nice powershell module and installed it. 

    When I run the powershell command I get an error (I am full admin in domain)

    Start-IPerfMonitorTest -FromServerName eb1248 -ToServerName eb1035

    ---------------------------------------------------------------------------------

    Output: 

    Start-IPerfMonitorTest : Netværksstien blev ikke fundet
    At line:1 char:1
    + Start-IPerfMonitorTest -FromServerName eb1248 -ToServerName eb1035
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Start-IPerfMonitorTest], IOException
        + FullyQualifiedErrorId : System.IO.IOException,Start-IPerfMonitorTest

     

    Can you give me a hint what is wrong? 

     

    Best regards

    Soren Mosel

    Denmark

    0

    • Swapnil Kambli 4 months ago

      Hi Soren,

      This module has the requirement of port 5001 to be open on all the nodes where scripts are running. Could you please check the nodes are fulfilling the network prerequisites.

      1+

      Users who have LIKED this comment:

      • avatar
  2. PowerMe! 1 week ago

    thought this would be of interest

    https://openmaniak.com/iperf.php

    0

Leave a reply

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2019

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account