Skip to content

Instantly share code, notes, and snippets.

@spyoungtech
Last active June 1, 2020 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spyoungtech/a5b32f7a53b128c76a0bd27d6b04ee0a to your computer and use it in GitHub Desktop.
Save spyoungtech/a5b32f7a53b128c76a0bd27d6b04ee0a to your computer and use it in GitHub Desktop.
Upgrade all WSL distros to version 2
$oldversion = "1"
$newversion = "2"
$output = wsl -l -v
$distros = $output -replace "`0",'' | ConvertFrom-String -PropertyNames Active,Name,State,Version | where {$_.Version -ne "VERSION"}
$outdated = $distros | where {$_.Version -like $oldversion}
$outdated | ForEach-Object {wsl --set-version $_.Name $newversion}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment