- Create a certificate-signed RDP shortcut via Group Policy - Fri, Aug 9 2019
- Monitor web server uptime with a PowerShell script - Tue, Aug 6 2019
- How to build a PowerShell inventory script for Windows Servers - Fri, Aug 2 2019
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:
$SiteServerMap = @{ 'Chicago' = 'CHISRV' 'Tokyo' = 'TOKSRV' }
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.
Start-IPerfMonitorTest -FromSite Chicago -ToSite Tokyo -Verbose
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.
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.
Subscribe to 4sysops newsletter!
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!
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
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.
thought this would be of interest
https://openmaniak.com/iperf.php
Do you need to install anything on the sites(host PCs)? Does this module install and start the iPerf software on the FromSite and ToSite PCs?