Set Windows 10 Ethernet connection to metered with PowerShell

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

    Change Permissions on DefaultMediaCost key

  4. Click Change to assign a different owner for the key.
    Change owner of Registry key

    Change owner of Registry key

  5. Type Administrators in the form field and click OK.
    Setting Administrators as key owner

    Setting Administrators as key owner

  6. Check Replace owner on subcontainers and objects and click OK.
    Replace owner on subcontainers and objects

    Replace owner on subcontainers and objects

  7. Select the Administrators group, give it Full Control, and click OK.
    Assign Full Control permissions to Administrators

    Assign Full Control permissions to Administrators

  8. Double-click the Ethernet key and set its value to 2.
    Set Ethernet connection as metered

    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.

All right, this is really a lot of click-click. If you have to do this often on different machines, you can just run the PowerShell script below.

I found it amazingly complicated to change the owner of a Registry key with PowerShell. I used Remko Weijnen's method. If you know a simpler way, please post a comment below.

After I assign the Administrators group as the owner of the DefaultMediaCost key, I give the group full control permissions.

In the last part of the script, I check to see if the Ethernet connection is set as metered or not and then ask the user whether the current configuration should be changed.

Poll: Does your organization plan to introduce Artifical Intelligence?

Read 4sysops without ads and for free by becoming a member!

5+
avataravatar
11 Comments
  1. Andre 4 years ago

    Hi Michael

    Thanks! for this little trick.

    It will be a great help, as Windows is trying to do too much in the background.

    Especially automatic updates of apps.

    All the background updating, can be very disruptive and counter productive, in a work environment.

    Windows does not always respect, your parameters.

    Thx!

    1+

    • Author

      You are welcome. But that's not just Windows. Most operating systems are doing this nowadays. You would be surprised to see how many different services on Mac are constantly connecting to Cupertino.

      1+

  2. Andre 4 years ago

    I haven't played with a mac, for over a year.

     

    great, good to know

     

    thx!

    2+

  3. Brian Gonzalez 4 years ago

    FYI, Here is how I've changed the ownership of reg keys in the past.

    REM Download and extract SetACL.exe to same directory as xxx.bat ( https://helgeklein.com/download/#setacl )
    "%~dp0SetACL.exe" -on "HKEY_LOCAL_MACHINE\importedsystem\ControlSet001\Enum" -ot reg -actn setowner -ownr "n:Administrators"
    "%~dp0SetACL.exe" -on "HKEY_LOCAL_MACHINE\importedsystem\ControlSet001\Enum" -ot reg -actn ace -ace "n:Administrators;p:full"

    But I kind of like your way better.

    -BG

    1+

  4. Brian Gonzalez 4 years ago

    What about Critical Windows Updates?  Will they come down on "metered" connection

    -BG

    1+

  5. Mike Tanis 4 years ago

    Thank you for this Michael Pietroforte. Very helpful. Excellent script!

    1+

  6. icsharp 4 years ago

    Hi, Michael!

    Thanks for the tip. I think you got a new reader 🙂

    Do you happen to know if the owner if the registry key will be replaced after a major update?

    1+

    • Author

      Thanks! I somehow doubt that Microsoft will modify the key through updates because I guess only few people know about this. But I wouldn't rely on it.

      2+

  7. Matthew 2 years ago

    On my Windows 10 1709 image I did not have to mess with permissions. Any local admin could change those keys. I added a step to my base image with:

    I did this for the following reasons:
    1) Disable most Windows Updates
    2) Prevent my remote sites on horrible connections from using up all their bandwidth - this can drastically reduce network speeds if 50-100 computers on a T1 start downloading updates
    3) Prevent my remote home users who are on satellite connections, or "pay as you go" connections from unknowingly using up all their data

    I do not see any issues with this unless you for some reason actively/interactively use the Windows Store for your end users...

    1+

  8. Nate 2 years ago

    To make this work on 32-bit Windows as well as 64-bit Windows, change the parameter type from ulong to uint:

    public static extern int RtlAdjustPrivilege(uint Privilege, bool Enable, bool CurrentThread, ref bool Enabled);

    1+

Leave a reply

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2020

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account