Last active
March 19, 2021 08:05
-
-
Save aessing/7d0bab29f3958188f238573cbb665408 to your computer and use it in GitHub Desktop.
Install WSL2 on Windows 10 (PowerShell)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ============================================================================= | |
# Install WSL2 on Windows 10 (PowerShell) | |
# https://docs.microsoft.com/de-de/windows/wsl/install-win10 | |
# ----------------------------------------------------------------------------- | |
# Developer.......: Andre Essing (https://www.andre-essing.de/) | |
# (https://github.com/aessing) | |
# (https://twitter.com/aessing) | |
# (https://www.linkedin.com/in/aessing/) | |
# ----------------------------------------------------------------------------- | |
# THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, | |
# EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED | |
# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. | |
# ============================================================================= | |
# Install required Windows 10 features | |
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart | |
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart | |
# Restart computer! Otherwise, WSL2 Kernel cannot be installed | |
Restart-Computer -Force | |
# Download WSL2 Kernel setup | |
Invoke-WebRequest -Uri "https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi" -OutFile wsl_update_x64.msi -UseBasicParsing | |
# Install WSL2 Kernel | |
Start-Process msiexec.exe -Wait -ArgumentList '/I wsl_update_x64.msi /quiet /norestart' | |
# Set WSL2 as default | |
wsl --set-default-version 2 | |
# Clean the kitchen | |
del -Force wsl_update_x64.msi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment