- Using PowerShell Scripts for Quality of Service (QoS) Policies
- Using Clumsy.exe Scripts
To run these scripts, you'll need to enable PowerShell script execution on your machine, or manually bypass the restricted execution policy when running the scripts.
If you want to change the script execution policy, open PowerShell as administrator and run the command below. This opens you up to any scripts being run and has security implications.
Set-ExecutionPolicy Unrestricted
If you instead prefer to keep your policy settings, you can run the scripts as follows from a shell:
powershell.exe -executionpolicy bypass <path-to-script>
You can limit the upload bandwidth of a specific application by using the create-upload-limit.ps1 script. The script will cap the upload rate of the script to a specified value. The script can be run multiple times to impose several caps on different apps concurrently.
Note: The ApplicationName parameter is optional. Not specifying a value will limit the upload rate of the entire system.
.\create-upload-limit -ApplicationName <name-of-application> -Bps <bits-per-second-limit>
To limit the (upload) speed of Ookla's speedtest software to 1Mbps, you can run:
.\create-upload-limit.ps1 -ApplicationName speedtest.exe -Bps 1000000
To limit all programs running on the machine to a combined 100 Kbps, you can run:
.\create-upload-limit.ps1 -ApplicationName speedtest.exe -Bps 100000
To clear all policies that have been applied, use the remove-policies.ps1 script.
.\remove-policies.ps1
You can view all active policies using list-policies.ps1. Note that applied policies are stored in the windows ActiveStore
Policy Store, meaning that they do not persist through system reboots.
.\list-policies.ps1
To use the powershell scripts that interact with clumsy, you will need to enable script running in windows. Refer back to this README section for that.
Clumsy is a free, open-source tool for Windows. It can be compiled from source or downloaded as an executable (which is the easier option). You can download it from here. Once downloaded, unzip it and place the files into a folder of your choice. We'll refer to this folder as the clumsy_folder
in the remainder of this README.
The provided start-clumsy.ps1
script supports several arguments. Some are targeted at bandwidth throttling, packet delays, and packet drop chance, while others are general.
The argument is provided as:
./start-clumsy.ps1 -ClumsyPath "<path to clumsy_folder>"
It tells the script where it can find the directory containing the clumsy.exe
executable which you downloaded previously.
The argument is provided as:
./start-clumsy.ps1 -AffectUpload $true
or:
./start-clumsy.ps1 -AffectUpload $false
It decides whether packet delays and packet drop chance affect outgoing traffic or not.
NOTE: Bandwidth limits set with clumsy are not affected by this (for the reasoning, ask the clumsy devs not me).
The argument is provided as:
./start-clumsy.ps1 -AffectDownload $true
or:
./start-clumsy.ps1 -AffectDownload $false
It decides whether packet delays and packet drop chance affect incoming traffic or not.
NOTE: Bandwidth limits set with clumsy are not affected by this (for the reasoning, ask the clumsy devs not me).
Clumsy does support limiting the bandwidth but, anecdotally, is bad at doing it. To limit the bandwidth, we recommend using the PowerShell QoS Option. However, for the sake of completeness, the wrapper script supports it.
The bandwidth limit is symmetric and not affected by the -AffectUpload
or -AffectDownload
arguments.
A bandiwdth cap can be specified in KB/s:
./start-clumsy.ps1 -ClumsyPath "<path to clumsy_folder>" -BandwidthKBps <Limit>
Note: The
Limit
argument must be an integer. This is enforced by PowerShell.
./start-clumsy.ps1 -ClumsyPath "C:\Program Files\Clumsy\" -BandwidthKBps 5000
Clumsy supports delaying packets with a set time Delay
in milliseconds. This is specified as an argument:
./start-clumsy.ps1 -ClumsyPath "<path to clumsy_folder>" -Delay <Delay>
Note: The
Delay
argument must be an integer number of miliseconds.
./start-clumsy.ps1 -ClumsyPath "C:\Program Files\Clumsy\" -Delay 5 -AffectUpload $true -AffectDownload $true
./start-clumsy.ps1 -ClumsyPath "C:\Program Files\Clumsy\" -Delay 30 -AffectUpload $true
Clumsy supports randomly dropping packets with a given DropChance
. This can be specified as an argument:
./start-clumsy.ps1 -ClumsyPath "<path to clumsy_folder>" -DropChance <DropChance>
Note: The
DropChance
must be a floating point number between 0 and 1. The powershell script will convert it into a number between 0 and 100 for clumsy. Up to 4 decimal positions are supported in your input, further ones will be rounded away.
./start-clumsy.ps1 -ClumsyPath "C:\Program Files\Clumsy\" -DropChance 0.25 -AffectUpload $true
./start-clumsy.ps1 -ClumsyPath "C:\Program Files\Clumsy\" -DropChance 0.05 -AffectUpload $true -AffectDownload $true
You can stop a running clumsy process using the stop-clumsy.ps1
script:
./stop-clumsy.ps1
Note: If clumsy is not running, this script is a No-Op, nothing will happen.