Wednesday, January 28, 2009

Windows 2008: Automate Command line backups

Windows 2008 backups has been driving me around the bend for a while now. Our corporate backup client is not supported on Win2008, and gone is NTBackup that we all have grown to loathe love so much over the past, what 400 years. From my experience, the backup utility included with Win2008 is limited in so many ways, but you can work around most of the limitations by using the command line.

The backup command looks like this:

wbadmin start systemstatebackup -backupTarget:<VolumeName> [-quiet]



Where VolumeName is the drive letter of the drive to store the backup on. (More info here). You will need to run this command with elevated permissions.



runas



By default, the backup command will not allow you to do store the backup on a drive that contains system information. To change this, you need to modify the registry on the machine as follows:




[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wbengine\SystemStateBackup]

"AllowSSBToAnyVolume"=dword:00000001




If the key does not exist, you will need to create it.



Now you will be able to write the backups to any drive on the server.



But, this is still a manual process. And we don’t like manual.



So, to automate the process, you will want to first create a batch file containing the backup command, that now looks like this, for example:




wbadmin start systemstatebackup -backuptarget:d: -quiet




Next up, you want to create a scheduled task. Open up Server Manager, and browse to Task Scheduler



compmgr1



Choose the library you want to create your task in. Right click, create new task (not basic task)



backupsschedule3



Give it a name, make sure the running account is correct and tick Run whether user is logged on or not and Run with highest privileges.



Set your schedule under Triggers, and then, under Actions, select your script.



Note: If you run this command daily, make sure you have enough disk space. Each backup takes up around 10GB, depending on your system configuration, and a new backup is created every time the command is run. The command does NOT delete old backups.



For more information about the backup command set, read here.

1 comment:

sympho said...

"At the moment I use it" - Windows' scheduler, I mean.

Related Posts with Thumbnails