https://github.com/skalyptosama/usb-drive-backup-script
A Windows Powershell script, batch file and sheduled task to automatically backup a usb drive to a machine when it is inserted (based on monotone's script)
https://github.com/skalyptosama/usb-drive-backup-script
backup batch batch-script powershell-script public task-scheduler unlicense unlicense-license usb usb-devices usb-drive windows
Last synced: about 1 month ago
JSON representation
A Windows Powershell script, batch file and sheduled task to automatically backup a usb drive to a machine when it is inserted (based on monotone's script)
- Host: GitHub
- URL: https://github.com/skalyptosama/usb-drive-backup-script
- Owner: SkalyptoSama
- License: unlicense
- Created: 2024-04-30T06:28:20.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-30T08:07:45.000Z (over 1 year ago)
- Last Synced: 2025-01-15T19:52:00.670Z (9 months ago)
- Topics: backup, batch, batch-script, powershell-script, public, task-scheduler, unlicense, unlicense-license, usb, usb-devices, usb-drive, windows
- Language: PowerShell
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# USB-backup
Windows PS Script and .bat to automatically backup a usb drive to a machine when it is inserted (based on monotone's script). Sources below.# Set up
To set up the automatic backup download Sync.bat, USB-backup.ps1 and USB-backup.xmlThe batch file should go at the root your usb drive and the PS script can go anywhere you want on your machine.
Open Sync.bat with a text editor and change the backup folder path.

Same with USB-backup.ps1 and change 'Mirror' to your drive name.

Then in Windows Task Scheduler, select import task and open USB-backup.xml
Go to 'Actions' and 'Modify' and in the 'Arguments' delete whats after -File and enter the full path to USB-backup.ps1

You can also remove -WindowStyle Hidden if you want to see the powershell window.

The -ExecutionPolicy Bypass argument allows the script to run.
# Sources
Monotone's script can be found here :
https://answers.microsoft.com/en-us/windows/forum/windows_vista-windows_programs/task-scheduler-how-to-automatically-synchronize-my/45a49d83-b1d8-4d37-8896-3d2696cf9795


Their work is based on these blog posts :
https://devblogs.microsoft.com/scripting/hey-scripting-guy-can-i-be-informed-when-a-portable-drive-is-added-by-my-computer/
https://devblogs.microsoft.com/scripting/hey-scripting-guy-can-i-format-a-portable-drive-when-it-is-inserted-into-a-computer/