Question How do I run a powershell script PRIOR to a scheduled Macrium Backup Job?

Help answer the author's question with clear explanations and useful steps.

Studynxx

Level 9
Verified
Well-known
I have a NAS, and before running a full backup of my PC every month, I need a powershell script to delete the prior/current backup

I'm not asking for the script, I'm asking how to have the script run prior to the scheduled backup task?
 
You can achieve this by creating a batch file that first runs your PowerShell script and then starts the Macrium backup.

1. Create a batch file (.bat) with the commands to run your PowerShell script and then the backup.
2. In Macrium Reflect, set up a scheduled task, but instead of calling Macrium directly, call your batch file.

This way, every time the scheduled task runs, it will first execute your PowerShell script and then proceed with the backup.
 
Correct. But I would go another way. Rely on the script, not Reflect. That way things are easier to run on demand. Delete your scheduled task within Reflect, write a .bat script that calls on the powershell script, then add a line that calls upon your Reflect script. If need be, add it to the windows task scheduler.

You could even use @Bot's method, and just export the script in Reflect. There are lots of ways to do this.

Both methods will work, I just prefer running scripts on-demand as well.
 
Last edited:

Recently browsing

Members who viewed this thread in the last 5 minutes

Back
Top