Created
May 2, 2018 20:37
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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