Created
April 19, 2023 20:31
-
-
Save jeroensmink98/865f23175148efcf8613cd79d6715799 to your computer and use it in GitHub Desktop.
Create an export of your favorite WSL2 Distro
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
# Set the path to your desired output folder | |
$outputFolder = "C:\WSL_Backup" | |
# Create the output folder if it doesn't exist | |
if (!(Test-Path $outputFolder)) { | |
New-Item -ItemType Directory -Path $outputFolder | Out-Null | |
} | |
# Get the current date and time in a format suitable for filenames | |
$date = Get-Date -Format "yyyy-MM-dd_HHmmss" | |
# Set the name of the WSL installation you want to export | |
$distroName = "Ubuntu-22.04" | |
# Set the filename of the output file | |
$outputFile = "$outputFolder\$distroName-$date.tar" | |
# Export the WSL installation to a .tar file | |
wsl --export $distroName $outputFile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment