Skip to content

Instantly share code, notes, and snippets.

@yonderbread
Created October 21, 2021 19:42
Show Gist options
  • Save yonderbread/74e2d84291e2bec4e996dac9bd73966a to your computer and use it in GitHub Desktop.
Save yonderbread/74e2d84291e2bec4e996dac9bd73966a to your computer and use it in GitHub Desktop.
PowerShell script to setup and install WSL2
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
$WSLUpdateFileName = "wsl_update_x64.msi"
$WSLUpdateFileUrl = "https://wslstorestorage.blob.core.windows.net/wslblob/$WSLUpdateFileName"
Clear-Host
(New-Object System.Net.WebClient).DownloadFile(
$WSLUpdateFileUrl,
"$env:APPDATA\$WSLUpdateFileName")
Start-Process ("$env:APPDATA\$WSLUpdateFileName")
wsl --set-default-version 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment