Simple PowerShell script that handles diffenrential backups via 7zip
- PowerShell
- PowerShell module "BurntToast"
- In PowerShell do
PS> Install-Module -Name BurntToast -RequiredVersion 0.4
to install it - 7zip (Note that
7z.exe
must be in yourPATH
or the script won't find it)
Run the script with following paramters:
backup.ps1 <PATH-TO-BACKUP> <DESTINATION-PATH>
To run powershell with this script in background, do the following:
powershell -windowstyle hidden -File C:\backup.ps1 "D:" "X:\Backups\\"
This will run the script, backup all contents of D:\
to a 7z-File that will be located at X:\Backups\
.
Note that you don't have to give a filename in destination path, the script will create one according to the backup path and a timestamp.
If you run the script the first time on a path you would like to backup, it will create a full backup of this path. It will then create a config file in this path with the location of the full backup. If you run the script on that path again, it will look for the full backup given in the config file and will perform a diffenrential backup against this.
The script will look for a .backupignore
file in the backup path. This has to be a 7z exclude list and will be applied recursively to the backup path.
Example:
$RECYCLE.BIN
Config.Msi
System Volume Information
desktop.ini
.sync