Skip to content

Instantly share code, notes, and snippets.

@imrodrigoalves
Last active October 26, 2022 15:46
Show Gist options
  • Save imrodrigoalves/c9c0b08696ad790149eb23f5b7e8c722 to your computer and use it in GitHub Desktop.
Save imrodrigoalves/c9c0b08696ad790149eb23f5b7e8c722 to your computer and use it in GitHub Desktop.
Allow WSL Fast Internet
@echo off
wsl exit
powershell -Command "Set-NetAdapterLso -Name 'vEthernet (WSL)' -IPv4Enabled $False -IPv6Enabled $False"
@jhmaster2000
Copy link

jhmaster2000 commented Sep 25, 2022

@imrodrigoalves I would like to propose changing the script to the following: (Explanation for why here + it's shorter and simpler)

@echo off
wsl exit
powershell -Command "Set-NetAdapterLso -Name 'vEthernet (WSL)' -IPv4Enabled $False -IPv6Enabled $False"

Edit: Also added a wsl exit line, after noticing that this does not work if WSL hasn't been ran at least once on the current boot, since the "vEthernet (WSL)" network adapter won't be created yet, therefore the command would fail. By running wsl exit we start WSL so it creates the network adapter and then immediately exit it once it's done, and then we can run the fix command.

Edit²: It may also be needed to select "Run whether user is logged on or not" (image 1 above) for the script to actually run. This has the added bonus of running the script in the background, so you don't see the empty command prompt window for a few seconds on boot. Do not check the "Do not store password" box. (You will be prompted for your login credentials when saving the task, this is normal)

@imrodrigoalves
Copy link
Author

@imrodrigoalves I would like to propose changing the script to the following: (Explanation for why here + it's shorter and simpler)

@echo off
wsl exit
powershell -Command "Set-NetAdapterLso -Name 'vEthernet (WSL)' -IPv4Enabled $False -IPv6Enabled $False"

Edit: Also added a wsl exit line, after noticing that this does not work if WSL hasn't been ran at least once on the current boot, since the "vEthernet (WSL)" network adapter won't be created yet, therefore the command would fail. By running wsl exit we start WSL so it creates the network adapter and then immediately exit it once it's done, and then we can run the fix command.

Edit²: It may also be needed to select "Run whether user is logged on or not" (image 1 above) for the script to actually run. This has the added bonus of running the script in the background, so you don't see the empty command prompt window for a few seconds on boot. Do not check the "Do not store password" box. (You will be prompted for your login credentials when saving the task, this is normal)

I've updated the command in the gist to make use of your suggestions.

Tested with Windows 11 and it works.

@jhmaster2000
Copy link

Awesome, good to know, thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment