Backing up Hyper-V virtual machines from the command line   1 comment


Use Windows Server Backup in Windows Server 2012 to backup virtual machines. One of the first questions that people had was “how do I do this from the command-line?”

The tool you will want to use is “wbadmin.exe”Backing up a virtual machine is fairly straight forward. Your command will look like this:
wbadmin start backup –backupTarget:<location to backup to> –hyperv:<list of virtual machines to backup>

Which will result in something like this:

image

Some things to be aware of:

  • Wbadmin will always warn you that the virtual machine will be put into a saved state for backup. This is wrong. The virtual machine will only be put into a saved state if it is not running the latest virtual machine additions (or is not a Windows virtual machine).
  • You will be prompted before the backup starts. You can get around this by adding –force to the end of the command.
  • You can use either the virtual machine name or the virtual machine ID when selecting virtual machines.
  • You can list multiple virtual machines to backup.
  • If you are backing up to a SMB share – new backups will automatically overwrite old backups (i.e. there will only be one backup kept on the share). This will not happen if you are backing up to a local disk.

Once you have created the backup – you then need to know how to restore it. This is, unfortunately, more complicated. The first thing you will need to do is to find the version of the backup and the name of the virtual machine you want to restor. You can find the version of the backup by running:

wbadmin get versions –backupTarget:<location where you backed up to>

image

If the backup was taken a while ago – you may have forgotten the name(s) of the virtual machines that you backed up. You can find this by running:

wbadmin get items –version:<version string for the backup you want> –backuptarget:<location where you backed up to>

image

Once you have this information you can restore the backed up virtual machine by running:

wbadmin start recover –version:<version string for the backup you want> –itemType:hyperv –items:<list of virtual machines to restore> –backuptarget:<location where you backed up to>

image

Advertisements

Posted 20/05/2013 by Petri in VMware

One response to “Backing up Hyper-V virtual machines from the command line

Subscribe to comments with RSS.

  1. This is a complete copy of https://blogs.msdn.microsoft.com/virtual_pc_guy/2013/02/25/backing-up-hyper-v-virtual-machines-from-the-command-line/
    You haven’t provided any new relevant information. You don’t even cite the source you stole it from.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: