-
-
Save imrodrigoalves/c9c0b08696ad790149eb23f5b7e8c722 to your computer and use it in GitHub Desktop.
@echo off | |
wsl exit | |
powershell -Command "Set-NetAdapterLso -Name 'vEthernet (WSL)' -IPv4Enabled $False -IPv6Enabled $False" |
@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 runningwsl 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.
Awesome, good to know, thanks 👍
@imrodrigoalves I would like to propose changing the script to the following: (Explanation for why here + it's shorter and simpler)
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 runningwsl 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)