Windows 10

Schedule Windows Image Backups



INTRO

You can schedule Windows Image Backups with command line. When it comes to using Windows Image Backup or Windows Server Backup as a backup solution it’s generally not viewed as a favorable option and for good reason, sometimes it just simply doesn’t work. However, it’s there for those that don’t want to spend the money on Acronis, Paragon, R-Drive Image, and others.

Personally, I would not rely on Microsoft’s built-in backup solution because there have been times where I discovered that the backup didn’t run, I will get more into this later. For Home users that want another free option I recommend Paragon Backup and Recovery CE (Community Edition).

You can build Recovery Media with the Windows ADK files for a Windows PE based recovery solution or run the software on your computer. It’s free and backed by a true and trusted brand. While feature limited it’s something.

SCHEDULE WINDOWS IMAGE BACKUPS

Microsoft’s solution uses wbadmin.exe located in the C:\Windows\System32 folder. We can use Task Scheduler to start wbadmin.exe and push some arguments to it to customize our needs, with the scheduling capabilities of schtasks.exe. In my testing this works OK, but sometimes the backup job will start to run then stop running. The job could run one week then fail the next.

You can use the Task Scheduler GUI to create your task but this is WinReflection, not fake news CNN and we can do better than that. We can automate it with Command Prompt with something like below, but the backup job won’t run when a Standard user is logged in because I tested it.

BAT (Batchfile)
schtasks /create /tn "Windows Image Backup" /tr "wbadmin start backup -backupTarget:W: -include:C: -allCritical -quiet" /sc monthly /d 15 /st 15:00 /ru System /rl Highest

For some reason in my testing above when I was logged in as Standard user the backup task did not run when on a schedule. It runs on-demand fine under an Administrator account but not when logged in as a user with non-administrator rights.

With research I believe it’s because I am using the option “/rl Highest” which selects the checkbox “Run with highest privileges.”. What that option does is run the task as selecting “Run as Administrator” and research shows the configured run user in the task with that option needs to be part of the local Administrators group which SYSTEM is not.

So the correct command will be.

BAT (Batchfile)
schtasks /create /tn "Windows Image Backup" /tr "wbadmin start backup -backupTarget:W: -include:C: -allCritical -quiet" /sc monthly /d 15 /st 15:00 /ru System

I did also get this working under a Standard user by configuring it to use the Administrator account with the following command.

BAT (Batchfile)
schtasks /create /tn "Windows Image Backup" /tr "wbadmin start backup -backupTarget:W: -include:C: -allCritical -quiet" /sc monthly /d 15 /st 15:00 /ru Administrator /rp  /np /rl Highest

If you do not use “/rp ” then you will be prompted to enter the password, obviously for automation reasons that won’t be helpful. The argument “/np” will select the checkbox, “Do not store password. The task will only have access to local computer resources.”

The created scheduled task called Windows Image Backup in Task Scheduler will backup the C: drive to the W: drive. A WindowsImageBackup folder will be created on the root of W: and will run in the background. It will run every month on the 15th at 3:00 PM.

The “-allCritical” argument creates a System Image and you can use the Windows Recovery Environment (Windows RE) to then go into Advanced Recovery Options and select “System Image Recovery” to point to your image. You can also boot a Windows 10 installation disc to do this if your boot drive is corrupted.

TROUBLESHOOTING

Now I ran into an issue where the backup was not running. Task Manager showed wbengine.exe (Microsoft® Block Level Backup Engine Service EXE) running for a short time then would stop. The logs are located in C:\Windows\Logs\WindowsBackup and in Event Viewer for Event ID: 521, I found an error regarding the Volume Shadow Copy Service.

I checked services and the Volume Shadow Copy service was set to Manual which shouldn’t be a problem. Starting the service or changing it to Automatic didn’t help. Disk Management showed that I had an extra Recovery Partition at the end of Disk 0 where the Windows partition resides.

I used Disk Part in CMD with the override parameter to delete it. I was messing around with WinRE in another project which is why it was there. I ran Check Disk on both drives and restarted. After this the backup ran without issues.

CONCLUSION

I hope this explains a little more about why Microsoft’s solution may not be the solution for you, but it is there, and we can automate and schedule it. If you work at a company that doesn’t want to spend money on a higher quality solution, then I hope this guide will help you in some way.

1 reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply to Alice Zee Cancel reply

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