How to uninstall & reinstall Windows Subsystem for Linux

Now that the Windows Subsystem for Linux (WSL) has been released to the masses in Windows 10 Anniversary Update and you have have installed the feature and had a play, What happens if you want to start from scratch and reset everything to a fresh state? This is something we often do in IT, especially when troubleshooting an issue. Instead of going into Programs & Features in Control Panel there is a very quick command you can run to perform the reset.

lxrun /uninstall

This will uninstall the WSL environment from your workstation. Combine it with:

lxrun /install

to reinstall the WSL environment and you are all reset.

You can also set root as the default user for WSL at the install phase with the following switch:

lxrun /install /y

Alternatively, you can define your own user at install with:

lxrun /install /setdefaultuser <username> /y

Note: if you omit the /y switch when defining your own username then you will be prompted to set a password for said user.

Super simple stuff! Go forth and get knee deep in the world of Linux, Windows Administrators

James Written by:


  1. Nurcahya

    hey i get this error code when i want to installing bash on windows
    “Error: 0x80070091”

    any sugestion?


  2. Jay Hammond

    what kind of shell accepts the lxrun command? Not windows powershell (native Windows) not cmd.exe. I can’t convince wsl I have installed a distro with the store or WSL. (which is why I want to get rid of WSL & reinstall it.) So I have no access to bash.

    • 26/10/2021

      Hey Jay,

      It seems you have picked up on the age of this post in that lxrun is a now depreciated command associated with the WSL version 1 environment. See here for more:

      With WSL version 2, a remove and readd of the Windows feature would net the desired result

      • 26/10/2021

        A quick suggests the PowerShell equivalent would be:

        Remove-WindowsFeature Microsoft-Windows-Subsystem-Linux

      • Jay Hammond

        Thanks for the heads up on the age of the post. I had foolishly ignored it. I have since removed the wsl feature on win 10, moved to Win 11 and requested WSL there. I now have different issues (with Debian)

Helpful? Have a question on the above?