Skip to content

Instantly share code, notes, and snippets.

@LockTar
Created May 2, 2018 20:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LockTar/d0b035f2469102c955ccf9276ab1e0bb to your computer and use it in GitHub Desktop.
Save LockTar/d0b035f2469102c955ccf9276ab1e0bb to your computer and use it in GitHub Desktop.
Sets metered connection on in Windows 10 for wifi in the train (NS Holland). In that way wifi is faster because background tasks are paused.
$wifiProfile = "WiFi in de trein";
#$wifiProfile = "Guest Hotspot";
# Get list of saved Wifi connections
#netsh wlan show profiles
# Show details of Wifi connection
$output = netsh wlan show profiles name=$wifiProfile key=clean
$costs = $output | Select-String -Pattern 'Cost'
$cost = ($costs -split ":")[2].Trim() -replace '""'
if ($cost -eq 'Unrestricted') {
Write-Host "Set metered connection on"
netsh wlan set profileparameter name=$wifiProfile cost=Fixed
}
else {
Write-Host "Set metered connection off"
netsh wlan set profileparameter name=$wifiProfile cost=Unrestricted
}
#netsh wlan show profiles name=$wifiProfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment