Loading...

Migrate all your distributions to WSL2 at once with PowerShell

Reply A+ A-

In this post I will show you how to use PowerShell to migrate all your current Linux distributions to WSL2 in just one time.

The context
- Windows 10 1909 was install
- You have installed the feature WSL
- Distributions used WSL 1
- You have migrated to Windows 10 2004
- You want to migrate all your distributions to WSL2
- You don't won't to manually migrate them one by one

The issue
Windows 10 2004, introduces a new version of WSL: WSL2.
You can set the default version of WSL you want to use, to 1 or 2, as below:
This one will change version for future distributions?
The issue is that if you have existing distributions they won't be migrated with this command.
To migrate existing distributions, you have to change them manually, one by one, booooring.
To change version of a distribution, use the command below:
The issue is, if you want for instance to migrate all your distributions once, you have to migrate them one by one, not cool.


The solution
In this script I will list existing distributions then use the above command to migrate them.

Note: The script should be executed in user context. 

Get the script
You can get the script by clicking on the GitHub picture below: 


Get the log
You can find a log for the process in %temp% WSL_Migration.log
WSL2 446048079793618611

Enregistrer un commentaire

Accueil item

Award

Learn KQL in one month

Sponsors

You want to support me ?

Mes articles en français

Books in French


Stats