Skip to content

Instantly share code, notes, and snippets.

@atbore-phx
atbore-phx / backup_wsl2gdrive.ps1
Last active March 8, 2024 22:06
backup, encrypt (7z), and rotate your wsl distribution via powershell script
# Requirements:
## install google drive for desktop
## Install 7z.exe
## 7z.exe must be in your Path env variable
# Define your parameters
$wslDist = "<your_wsl_name>" # WSL Distribution
$tempDirectory = [System.IO.Path]::GetTempPath()
$backupFolder = "G:\My Drive\backup\Wsl\$($wslDist)" # Backup destination
$date = Get-Date -Format "yyyyMMddHHmm"