I had unexpected amount of trouble once when I was given task to measure bandwidth between server and lots of points in LAN. Googling showed that a lot of people care a great deal about their Internet bandwidth (I do understand them :) ) but very few care about exact numbers for their LAN bandwidth.
In the end I used Passmark PerformanceTest that worked excellent, but it was taking a lot of time to set up for every point. I had to call remote user, kick him off PC, connect to his desktop, copy PerformanceTest there, launch it in listening mode and only then start test from server side.
So when I had read about two utilities (NetCPS and iperf) for exactly that purpose while being command-line in design on gHacks it sparked my interest again.
I couldn’t get NetCPS (site was down) so iperf it is.
Main problem is that any bandwidth testing program must be run on both ends, so for desired goal (easy and fast setup) this must be executed without disturbing remote user’s desktop session. iperf is capable of running as system service, but distributing it to all PCs and keeping in autorun weren’t needed.
So psexec it is. psexec is very good command line utility from Sysinternals that allows to execute remote commands on network computers (if you have security rights to do so).
Additionally I need to cleanup remote side so pskill is needed as well. pskill is even better utility from same source that allows to kill remote proccesses. :) Effect of carpet bombing whole LAN with name of latest popular game is way too much fun! Oops, got sidetracked… :)
Basic setup is following (I called my folder iperf):
This folder must be shared, let’s assume that it has following network path:
After bit of tinkering I ended up with following script
psexec \\%1 -s -d "\\cutepc\iperf\iperf.exe" -s
iperf -c %1
pskill \\%1 iperf.exe
which I saved as text file
So command for actual test is going to be (assuming we are testing bandwidth to computer named “targetpc”)
Line by line analysis:
- disables echo (output of commands to screen)
- launches iperf in listening mode on remote PC. “%1″ is parameter that gets replaced with “targetpc” in my example. Note that there are two “-s”, it’s not mistake – one is parameter for psexec (runs process as SYSTEM), other is for iperf (start as server)
- clears screen
- launches local copy of iperf and starts test
- outputs empty line
- pauses after results
- kills remote iperf
Result looks like this:
Client connecting to targetpc, TCP port 5001
TCP window size: 8.00 KByte (default)
 local 10.73.186.97 port 1461 connected with 10.73.186.140 port 5001
[ ID] Interval Transfer Bandwidth
 0.0-10.4 sec 568 KBytes 448 Kbits/sec
By default test runs for 10 seconds, for further tweaking (you might need to correct psexec parameters as well if LAN security setup is different from mine) read:
PS No! My computer is not called “cutepc”! Honestly! :)
psexec home&download page http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx
pskill home&download page http://technet.microsoft.com/en-us/sysinternals/bb896683.aspx
Sysinternal Suite (which contains psexec, pskill and plenty of other utilities) home&download page http://technet.microsoft.com/en-us/sysinternals/0e18b180-9b7a-4c49-8120-c47c5a693683.aspx
iperf home page http://dast.nlanr.net/Projects/Iperf/
iperf sourceforge page http://sourceforge.net/projects/iperf/
iperf download page (compiled windows executable) http://www.noc.ucf.edu/Tools/Iperf/