Last active
June 1, 2020 11:19
-
-
Save spyoungtech/a5b32f7a53b128c76a0bd27d6b04ee0a to your computer and use it in GitHub Desktop.
Upgrade all WSL distros to version 2
This file contains hidden or 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
$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