Windows Subsystem for Linux (WSL) – How to Get Default Version

windows-10-v2004windows-10-v20h1windows-subsystem-for-linux

WSL allows you to set the default version used by running wsl --set-default-version x (where x is the version to set the default to).

Is there any option to see what the current default version is? wsl --get-default-version is not recognized.

Best Answer

The WSL default version is stored in a registry entry.

The key is stored at HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss in an entry named DefaultVersion. The value can either be 1 or 2.

To read the value in PowerShell, you can use the following:

Get-ItemPropertyValue `
      -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss `
      -Name DefaultVersion
Related Question