Skip to content

Instantly share code, notes, and snippets.

@alatas
Created October 14, 2017 21:39
Show Gist options
  • Save alatas/24a77edc401db6a4907fbc4b15b9f7be to your computer and use it in GitHub Desktop.
Save alatas/24a77edc401db6a4907fbc4b15b9f7be to your computer and use it in GitHub Desktop.
7Zip Full and Diff Backup Script
function Backup {
param(
[Parameter(Mandatory = $True)][string]$Inputs,
[Parameter(Mandatory = $True)][string]$FullBackup,
[string]$DiffBackup = $null,
[string]$7ZPath = "C:\Program Files\7-Zip\7z.exe",
[string]$UpdateSwitch = "-up0q0r2x2y2z0w2!"
)
if ($DiffBackup -eq $null) {
& $7ZPath a -mhe -ms=off -ssw -mx= -t7z $FullBackup $Inputs
}
else {
& $7ZPath u -mhe -ms=off -ssw "$FullBackup" "$Inputs" -mx=7 -t7z -u- $UpdateSwitch$DiffBackup
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment