0

I purchased MS Surface Pro X and updated Windows to Version 1903 (OS Build 19018.1) using the Insider Program. I followed the WSL2 doc and installed Ubuntu 18.04 for ARM.

Everything seemed fine but WSL works only in cmd not in Powershell(Admin mode). The wsl.exe is in C:\Windows\System32 and Powershell can't see the file.

The error message is:

The term 'wsl' is not recognized as the name of a cmdlet, function, script file, or oparable program.

I run WSL2 on my other computers without any problem. Only this device has the issue.

Please advise.

[Edit]

This is the result of 'winver' command:

enter image description here

This is from 'cmd':

enter image description here

This is from 'powershell':

enter image description here

[Edit #2]

PATH from cmd as Administrator C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Git\cmd;C:\Users\ssk\AppData\Local\Microsoft\WindowsApps;C:\Users\ssk\AppData\Local\Programs\Microsoft VS Code\bin

PATH from Powershell as Administrator C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Git\cmd;C:\Users\ssk\AppData\Local\Microsoft\WindowsApps;C:\Users\ssk\AppData\Local\Programs\Microsoft VS Code\bin

enter image description here

enter image description here

1

I purchased MS Surface Pro X and updated Windows to Version 1903 (OS Build 19018.1) using the Insider Program. I followed the WSL2 doc and installed Ubuntu 18.04 for ARM.

You are absolutely NOT running Windows 10 version 1903. There are multiple reasons I know what version you are actually running. First, WSL 2 is not a feature of 1903, it's a feature of 1909, and 19018.1 is a build after the 1909 build (18363.1).

However, the source of your error is due to your system PATH variable is missing %SystemRoot%\system32

  • 10.0.18362.476 is May 2019 Update
  • 10.0.18363.476 is November 2019 Update

RESOLVED. Somehow when I removed PowerShell 6, the %SystemRoot%\system32 and C:\Windows\System32 entries were removed from the PATH. It came to me as I was falling asleep last night to look this morning, and sure enough, those entries were gone. All is well now. Thanks for your help!

Source: WSL is not recognized as the name of a cmdlet, etc.

Powershell can't see the file.

If you were to navigate to C:\windows\system32\ and then run wsl.exe --set-default-version 2 PowerShell would absolutely see the executable.

  • Thank you for the comments. I added some screen captures to my original posting. The version that I described is correct according to winver. The wsl is there according to cmd but not powershell. I don't think it's PATH problem because C:\Windows\System32 is in the PATH but wsl is not recognized by powershell. – Sam Kong Nov 13 '19 at 15:36
  • I even tried to run with full path like 'C:\Windows\System32\wsl.exe' but it was not recognized. I don't understand how that happens. I'll keep trying. Thanks. – Sam Kong Nov 13 '19 at 18:45
  • Thank you for being interested in my issue. I added PATH and screenshots. Please see [Edit #2]. The Powershell version is 5.1.19018.1. – Sam Kong Nov 14 '19 at 23:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.