Wsl: `wsl` command not recognized after enabling WSL2

Created on 13 Jun 2019  Â·  15Comments  Â·  Source: MicrosoftDocs/WSL

The wsl command is not recognized after enabling the VirtualMachinePlatform as instructed:

PS C:\WINDOWS\system32> Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform


Path          :
Online        : True
RestartNeeded : False



PS C:\WINDOWS\system32> wsl --list --verbose
wsl : The term 'wsl' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ wsl --list --verbose
+ ~~~
    + CategoryInfo          : ObjectNotFound: (wsl:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\WINDOWS\system32>

Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

  • ID: b19a43be-b16a-d903-b69d-75dffce6c329
  • Version Independent ID: f9d4a118-1251-8d6b-43f5-2e64808dc527
  • Content: Install WSL 2
  • Content Source: WSL/wsl2-install.md
  • Product: windows-subsystem-for-linux
  • GitHub Login: @mscraigloewen
  • Microsoft Alias: mscraigloewen

Most helpful comment

try this

wsl -s Ubuntu-18.04 2

All 15 comments

WSL isn't automatically installed. You have to enable it in admin Powershell with the usual Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Thanks @Inclushe . I've tried that but options like --set-default-version 2 are not available. Maybe installing VirtualMachinePlatform replaces the wsl executable and I should have installed WSL first?

I'm having same issue PS
PS C:\WINDOWS\system32> wsl --set-version Ubuntu-18.04 2
Invalid command line option: --set-version

You need to be on the latest Windows 10 Insider Fast build - if you open the command prompt you should see 10.0.18917 (or higher). If not you need to subscribe to the Fast ring and update.

ok thanks

try this

wsl -s Ubuntu-18.04 2

I re-ran Windows Update and was now able to see 10.0.18917 as mentioned by @iggyvolz , which fixes the issue. Thanks.

I am on 18917 and enabled Virtual Machine Platform and my machine restarted. I'm still getting the WSL not recognized error.

Hi @kerryog just to confirm do you have the Windows Subsystem for Linux optional feature enabled?

To check, what's the result of this command if you run it in a PowerShell Window with Admin privileges?

Get-WindowsOptionalFeature -Online | Where-Object {$_.FeatureName -eq "Microsoft-Windows-Subsystem-Linux"} | Format-Table

wsl -l doesn't show a list if distros I can use, it just displays:

"Windows Subsystem for Linux has no installed distributions.
Distributions can be installed by visiting the Microsoft Store:
https://aka.ms/wslstore"

Could you try running the command:

wsl --set-default-version 2

And then follow this link: https://aka.ms/wslstore and install a distribution (like Ubuntu) and then run the app. That should get you set up.

I am getting this

PS C:\WINDOWS\system32> wsl --set-version Ubuntu-18.04 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Please enable the Virtual Machine Platform Windows feature.
PS C:\WINDOWS\system32> wsl -l -v
  NAME            STATE           VERSION
* Ubuntu-18.04    Stopped         1
PS C:\WINDOWS\system32>

@mscraigloewin when I run your command, I get that WSL is disabled. I get this when I run the first command. And the first time I ran it, it asked me to reboot, which I did. Is there a HW limitation? I'm running on a Core i5-3320M

PS C:\WINDOWS\system32> Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform

Path :
Online : True
RestartNeeded : False

OK, Craig's question got me looking and it's working after I installed WSL. This should be added to the WSL 2 instructions

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

@Akumzy please enable the Virtual Machine platform using this command in a powershell window with admin privileges:

Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform

And @kerryog you're right! I've updated the WSL 2 install docs to include a note of what build you need to be on, and that you need to have WSL 2 installed with a link on how to do that.

Thanks for your submission! Now that everything works I'll close out this issue.

Was this page helpful?
0 / 5 - 0 ratings