Thursday, 29 September 2016

Set Windows 10 Ethernet connection to metered

If you set your internet connection to metered, Windows will limit automatic downloads such as Windows Update. Whereas a Wi-Fi connection can be set to a metered connection easily with a few mouse clicks, things are a bit more complicated with an Ethernet connection. I wrote a little PowerShell script that allows quick switching between metered and not metered connections.

Mobile internet connections are automatically set to metered, and you can configure Wi-Fi connections as metered in Windows 10 network settings. The latter makes sense when you connect to the internet via mobile Wi-Fi router. But why would want to set an Ethernet connection to metered?

First of all, in my view, the assumption that you always have plenty of bandwidth if you connect via Ethernet is wrong. If you travel to developing countries or remote areas where good internet bandwidth is still a problem, you know what I mean. If you have to download a huge file, you want to make sure you get all the available network speed, and you don’t want to compete with Windows Update and other Windows services for bandwidth.
There also are cases where Windows thinks it uses an Ethernet connection, but actually, it connects via a mobile internet connection—for instance, when you run a virtual machine on a laptop connected via a mobile Wi-Fi router. Many times, Windows Update consumed my whole daily data plan within a couple of minutes on a VM, where I would restore a snapshot anyway, and all the downloaded updates were lost. This can be quite annoying, and it is the reason I constantly seek options to prevent Windows from automatically downloading stuff I don’t really need now.
The advantage of setting an Ethernet connection as metered instead of disabling Windows Update is that you also knock off other bandwidth-consuming services, such as automatic app updates, peer-to-peer uploading of updates, and tile updates. In addition, some third-party Windows and desktop apps recognize metered connections.
Unfortunately, the procedure to set an Ethernet connection as metered is quite longwinded, because, by default, Administrators don’t have the right to change the corresponding Registry key. For the sake of completeness, I show you how to do it with the Registry editor. But if you want to avoid all this click-click, you can simply run the PowerShell script below.
  1. Run Registry editor (Windows key + R, type regedit, click OK)
  2. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\DefaultMediaCost
  3. Right click DefaultMediaCost, select Permissions, and click Advanced.
Change Permissions on DefaultMediaCost key
  1. Click Change to assign a different owner for the key.
Change owner of Registry key
  1. Type Administrators in the form field and click OK.
Setting Administrators as key owner
  1. Check Replace owner on subcontainers and objects and click OK.
Replace owner on sub-containers and objects
  1. Select the Administrators group, give it Full Control, and click OK.
Assign Full Control permissions to Administrators
  1. Double-click the Ethernet key and set its value to 2.
Set Ethernet connection as metered
You can set a Favorite in the Registry editor, if you want to change the key quickly later. To reset the Ethernet connection as not metered, you have to change the value to 1.




No comments: