My Restic Backup Solution with Windows 11

Mar 16, 2025 | Computers and Tech, Uncategorized | 0 comments

Recently, I posted an article about how to use Restic CLI to make backing up your files easy. Today, we’ll take that a setup futher and go over my own way of using a combination of Restic, Windows 11, Powershell and Task Scheduler to automate a daily backup with Restic.

Let’s not waste any time, this is a really simple solution so let’s dive right in.

Install Restic and Setup your repo

If you haven’t done so already, setup Restic and create a repository to hold your backup. As mentioned previously if you aren’t sure how, just see this article I wrote before and you should be good to go!

 

Create a Powershell script file

This is the hardest part so let’s do this first. Use notepad or your favorite editor and create a file named “dailybackup.ps1”

The filename is really up to you but what’s important is that ps1 file extension. This will tell windows it’s an actual Powershell script file.

In the file its time to do a little editing. Add the following to start:

$env:RESTIC_PASSWORD=”YOUR PASSWORD”
$repoPath = “E:\Backup”
$folder1=”C:\”
$folder2=”D:\Archive”
restic backup -r $repoPath $folder1 $folder2

Write-Host “Backup complete.”

Now to explain a little:
The password field will hold the password you setup for the Restic repository you created when you setup Restic. If you haven’t created a respository go ahead and do that now and save your password and enter it there.

NOTE: I know storing plain text passwords is never a good idea but for the purposes of making this simple fore beginners, we’re just going to do it this way. After all this is just the password for your backup repository.

$repoPath – Change this to whatever path your backup repository is stored on.

$folder1, $folder2, etc. – These are the folders you want backed up automatically. You can add as many as you want but you need to make sure you add them to the next line.

restic backup -r $repoPath $folder1 $folder2 – This line executes the backup. First we tell restic the path to our repository, then we tell it which folders we want backed up.

Save the file when you are done editing.  I suggest saving it in your C:\ path so its easy to find when you get to the Task Scheduler step

 

Create a bat file to call the Powershell script

Next we want to create a file with a similar name, but with the .bat file extension. For example “dailybackup.bat”.

Edit the file and paste in the following:

@echo off
powershell -ExecutionPolicy Bypass -File “C:\dailybackup.ps1”

This file will create a point of entry we can use in Task Scheduler to run our backup script. We basically tell it to bypass the security execution policy to run our shell script with this file.

 

Create a task in Task Scheduler

In the Search bar in windows type Task Scheduler and open it. On the right hand side click “Create Basic Task”

In the window that opens name the task and click next.

For Trigger select the frequency you want and the time you want it to run. For example I usually pick a time I know I won’t be using the computer for my backups.

Click next again and for the action select start a program. Here you can click Browse and navigate to the place we stored the bat file. Its important to choose the bat file and not the ps1 file as the default security of windows will likely prevent that file from executing. Instead the bat file will call the script and all should be well.

 

Conclusion

And that’s that! It’s really that easy to automate backups with a robust Open source tool like Restic. The above can really be used for all sorts of programs but I really only do something like this for my backups. I hope you enjoy and find it it useful! Thanks for reading!

 

 

 

 

 

 

Written by Brian Ebarb

Related Posts

How to use Restic CLI for Backups

How to use Restic CLI for Backups

Your Data, Your Problem If you don't have possession of it, do you really own it? This is the question I've always asked myself when it comes to my data and cloud storage. This is why I have my own personal cloud on my home network. And because I don't want to lose...

read more

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *