WBAdmin command line front-end
Get the best from your windows tools !
Windows Backup System is the new block-level backup technology Microsoft provides for Windows Vista, Windows Server 2008 and Windows 7. wbadmin is its command line interface.
- How it works
- A word about wbadmin
- Getting started
- Job parameters
- Systemstate backup
- Tips
- Mail report
How it works
MKSBackup run wbadmin using parameters found in the configuration file and send an email including the status in the subject, the log file, related events from the Event Viewer and a list of last backups. All these informations should allow the backup operator to forge an idea about the backup status.
A word about wbadmin
Wbadmin is complex, here is a very quick introduction of what you have to know.
For short :
- wbadmin use Volume Shadow Copy Service (VSS) on the source disk to backup only changed block and does a kind of incremental backup. Every 15 backups, wbadmin does a full backup.
- wbadmin use VSS on the target disk (when possible) to maintain multiple versions of the backup.
- wbadmin on Windows Vista, Server 2008, Server 2008R2, and Windows 7 are all different, having different features, options and requirements !
- System state backups have also specifics requirements depending on Windows version !
If you have a problem, read the log file for error messages ! Search the command line used by MKSBackup and try to run the command in a command prompt and start command wbadmin get status in another command prompt to read the log in real time and search for errors. Please don't report errors before to have tried the command itself !
Getting Started
For more information on how to install and start MKSBackup,
visit the Overview page.
When you have installed MKSBackup into C:\Magik\MKSBackup,
initialize your C:\Magik\mksbackup.ini like this:
[DEFAULT]
smtp_host=smtp.yourprovider.com
sender=backup.operator@server01.example.com
recipients=me@example.com someone.else@domain.com
[JOB]
program=wbadmin
include=C:
destination=<copy=mon-sun>\\nas01\backup\server-${nweekdayname}
This configuration will backup the C: drive on the network share \\nas01\backup in a directory different every days. Now check your configuration using the checkmail command. This command checks the validity of all parameters and reports any errors. If possible, it will send errors or success through emails to also test the email configuration.
C:\Magik> C:\Magik\MKSBackup\mksbackup.exe -c C:\Magik\mksbackup.ini -v checkmail JOB
Create the \\nas01\backup directory to avoid a warning about non existing directory !
logging in mksbackup.log
13:50:07,405 INF start ['C:\\Magik\\MKSBackup\\mksbackup.exe', '-c', 'C:\\Magik\\mksbackup.ini', '-v', 'checkmail', 'JOB']
13:50:07,515 INF cmdline=wbadmin.exe start backup -quiet -backupTarget:\\nas01\backup\server-Fri -include:C:
13:50:07,530 INF No error in section: JOB
13:50:07,530 INF Destinations day by day:
13:50:07,530 INF Fri 07 May 2010 copy \\nas01\backup\server-Fri
13:50:07,953 INF Sat 08 May 2010 copy \\nas01\backup\server-Sat
13:50:07,953 INF Sun 09 May 2010 vssfull \\nas01\backup\server-Sun
13:50:07,967 INF Mon 10 May 2010 copy \\nas01\backup\server-Mon
13:50:07,967 INF Tue 11 May 2010 copy \\nas01\backup\server-Tue
13:50:07,983 INF Wed 12 May 2010 copy \\nas01\backup\server-Wed
13:50:07,983 INF Thu 13 May 2010 copy \\nas01\backup\server-Thu
The check and checkmail commands calculate and display the locations of the destination directories for the next few days. When everything is OK, start the backup for real using the backup command.
C:\Magik> C:\Magik\MKSBackup\mksbackup.exe -c C:\Magik\mksbackup.ini backup JOB
When the backup is done, you have a short resume.
logging in mksbackup.log
06:39:03,437 INF start ['C:\\magik\\mksbackup\\mksbackup.exe', '-c', 'mksbackup.ini', '-d', '-v', 'backup', 'JOB']
06:39:03,562 INF cmdline=wbadmin.exe start backup -quiet -backupTarget:\\nas01\backup\server-Fri -include:C: -vssFull
06:39:03,562 INF No error in section: JOB
06:39:03,562 INF start command=backup job=JOB archiver=wbadmin
06:39:03,592 INF run: wbadmin.exe start backup -quiet -backupTarget:\\nas01\backup\server-Fri -include:C: -vssFull
06:39:29,796 INF run: WEVTUTIL.EXE qe Microsoft-Windows-Backup /rd:true /e:root
/f:RenderedXml /q:*[System[TimeCreated[timediff(@SystemTime)<=27000]]]
06:39:29,983 INF end command=backup job=JOB archiver=wbadmin
06:39:29,983 INF name=JOB
06:39:30,000 INF program=wbadmin
06:39:30,000 INF version=0.8.4b
06:39:30,000 INF hostname=WIN-YCH11YX3VQW
06:39:30,000 INF status=OK
06:39:30,000 INF exit_code=0
06:39:30,000 INF hresult=0
06:39:30,000 INF message=Backup completed.
06:39:30,000 INF target=C:
06:39:30,000 INF target_free_space=2007183360
06:39:30,000 INF target_size=708477262
06:39:30,000 INF start=Fri May 07 06:39:03 2010
06:39:30,000 INF end=Fri May 07 06:39:28 2010
06:39:30,000 INF wba_cmd=wbadmin.exe start backup -quiet -backupTarget:\\nas01\backup\server-Fri -include:C: -vssFull
06:39:30,000 INF wevt_cmd=WEVTUTIL.EXE qe Microsoft-Windows-Backup /rd:true /e:root /f:RenderedXml /q:*[System[TimeCreated[timediff(@SystemTime)<=27000]]]
06:39:30,015 INF wevt_exit_code=0
You should receive an email report including the wbadmin log and more details. You could have used -d switch to increase logging verbosity and display wbadmin log at the end of the backup.
To schedule your backup, read How to schedule MKSBackup
Job parameters
program (mandatory)
To use the wbadmin backend, program must be set to wbadmin.
program=wbadmin
include
This is a comma separated list of disk to backup. This parameter is passed as is to the -include option.
Check the wbadmin documentation for all possible values.
include=C:,D:
destination
This specifies where the backup will be stored. This parameter follows the destination syntax.
destination=<copy=mon-fri>\\nas01\backup-${nweekdayname}
<vssfull=sat,wsat/2>\\nas02\backup-week${nweek}
<none=sun>
The type can take value in copy, vsscopy, vssfull or none. copy and vsscopy are synonymous. vsscopy and vssfull generate identical backup, but vssfull update the file's history to reflect that it was backed up. vsscopy and vssfull will add respectively -vssCopy and -vssFull to the command line, copy is the default and will not change the command line at all. -vssCopy don't exist on Vista and Windows 2008 (non R2). Be careful when you are mixing copy, vssfull and other backup tools. Read the wbadmin documentation of your system for more.
The target can be a drive path (C:\path), a UNC network path (\\host_or_ip\directory) or even a volumeid (\\?\Volume{3a453567-........})
user (optional)
When the destination is a network path, you can specify the credential used to connect to it.
user and password must be defined together !
user=username
password (optional)
When the destination is a network path, you can specify the credential used to connect to it.
user and password must be defined together !
password=secret
options (optional)
You can specify additional options using the options parameters. Options will be added to the wbadmin command line. Check your wbadmin help for more.
Options are separated by spaces. If one option contains space, it must be quoted using double quote charactere ".
Valid options are:
- -allCritical
- -noInheritAcl
Windows 2008 R2 allow more options :
- -exclude
- -nonRecurseInclude
- -nonRecurseExclude
- -systemState
options=-allCritical -noInheritAcl
wbadmin_bin (optional)
This is the path of the wbadmin executable. You should never change this value ! Default is %SystemRoot%\system32\wbadmin.exe. On 64bits system running a 32bits MKSBackup version, %SystemRoot%\sysnative\wbadmin.exe is used instead.
wbadmin_bin=C:\Windows\System32\wbadmin.exe
wevtutil_bin (optional)
This is the path of the wevtutil executable. You should never change this value ! Default is %SystemRoot%\system32\wevtutil.exe. On 64bits system running a 32bits MKSBackup version, %SystemRoot%\sysnative\wevtutil.exe is used instead.
wevtutil_bin=C:\Windows\System32\wevtutil.exe
machine (optional)
This is the hostname. Don't change this value ! The value is used in command wbadmin get version.
machine=<hostname>
Backup systemstate
MKSBackup can also make a system state backup using the wbadmin start systemstatebackup. Here is a configuration file sample :
[SYSTEMSTATE]
program=wbadminsys
destination=<systemstate=sun>E:
<none=mon-sat>
keepversions=2
program
This time the program must be wbadminsys.program=wbadminsys
destination
The only valid types are systemstate and none. The target must be a local drive, network share are not allowed.
destination=<systemstate=mon-sun>E:
For more information check the common parameters page.
keepversions
This is the maximum number of system state backups you want to keep.
keepversions=2
MKSBackup will run the next command to meet the keepversions constraint.
wbadmin delete systemstatebackup -backupTarget:e: -keepVeersions:1
before to start the systemstate backup. Please note the 2 become 1 in the command to make some free space before to start the backup.
wbadmin_bin (optional)
See above
wevtutil_bin (optional)
See above
Tips
When the backup is running, you can follow its status by running the command :
C:\> wbadmin get status
Mail report
The mail report reproduce the usual structure but can also include the following attachments.
- wba_out.txt This is the wbadmin log file.
- wba_versions_out.txt Lists details about all the previous backups that could still be available now.
- wevt_out.txt This is a selection of records from the event log related to the backup. This file is in XML format.
- dir.txt This is the listing of the target directory.
- dir_up.txt This is the listing of the parent ot the target directory.