I am attempting to get iperf3 to run as a windows service. I see notes in documentation about the -D command and the -R command for installing the service and for removing it.
I am able to run -D and it runs in the background of Windows but not as a Windows service under services.msc.
I have tested in Windows 2008R2, Windows 2012R2, and Windows 10.
Is it possible to run as a Windows Service? If so, what command should I run?
Here is what I am running: iperf3.exe -s -D
I tried with the latest build of iperf 2. Same behavior.
iperf3 is really designed for, and only supported on, UNIX-like operating systems.
Some people have made Windows variants, you should try contacting one of them, or perhaps someone will see this issue comment.
@bmah888 can you remove the reference to running iperf as a Windows service in the user docs? It's confusing since it's unsupported and doesn't work anymore. https://iperf.fr/iperf-doc.php#service
Hrm, thanks for the suggestion. I don't control the content on iperf.fr (and that section seems to apply to iperf2, whereas I maintain iperf3), but let me see if I can get your message to the right people.
Install iperf3 as Windows service.cmd
::
:: Install iperf3 as Windows service
::
SET iperfdir=C:\iperf3
SET iperfprog=iperf3.exe
SET iperflog=iperf3-server-logs.txt
SET servicename=iperf3
SET start=auto
SET binpath=%iperfdir%\srvany.exe
SET iperfoptions=--server --daemon --port 5201 --version4 --format [m] --verbose --logfile %iperfdir%\%iperflog%
SET displayname=iPerf3 Service
SET description=iPerf3 Service provide a possibility to test network speed
::
::
sc.exe create %servicename% displayname= "%displayname%" start= %start% binpath= "%binpath%"
sc description %servicename% "%description%"
::
reg add HKLM\SYSTEM\CurrentControlSet\services\%servicename%\Parameters /v AppParameters /t REG_SZ /d "%iperfoptions%"
reg add HKLM\SYSTEM\CurrentControlSet\services\%servicename%\Parameters /v Application /t REG_SZ /d "%iperfdir%\%iperfprog%" /f
::
pause
::
Install iperf3 as Windows service.cmd
file as administrator.net start iperf3
net stop iperf3
We noticed that some times, iperf3 in service mode, stop working and only service restart helps. As a simple workaround we created a simple batch file and scheduled it to run each day:
Restart-iperf3-service.cmd
::
:: Stop iperf3 service
net stop iperf3
::
:: Start iperf3 service
net start iperf3
::
nssm is a much better option than srvany from the resource kit.
Most helpful comment
Install iperf3 as Windows service
Requirements
Installation
Install iperf3 as Windows service.cmd
Install iperf3 as Windows service.cmd
file as administrator.Issues
We noticed that some times, iperf3 in service mode, stop working and only service restart helps. As a simple workaround we created a simple batch file and scheduled it to run each day:
Restart-iperf3-service.cmd
Related documents