{"id":1201,"date":"2013-11-08T08:19:56","date_gmt":"2013-11-08T13:19:56","guid":{"rendered":"http:\/\/swildow.darktech.org\/wp\/?p=1201"},"modified":"2013-11-08T08:19:56","modified_gmt":"2013-11-08T13:19:56","slug":"backing-up-hyper-v-virtual-machines-from-the-command-line","status":"publish","type":"post","link":"https:\/\/www.wildow.com\/blog\/?p=1201","title":{"rendered":"Backing up Hyper-V virtual machines from the command line"},"content":{"rendered":"<h3>Backing up Hyper-V virtual machines from the command line<\/h3>\n<div>RATE THIS<br \/>\n<img decoding=\"async\" alt=\"\" src=\"http:\/\/blogs.msdn.com\/Utility\/images\/star-left-on.png\" align=\"absmiddle\" border=\"0\" \/><img decoding=\"async\" alt=\"\" src=\"http:\/\/blogs.msdn.com\/Utility\/images\/star-right-on.png\" align=\"absmiddle\" border=\"0\" \/><img decoding=\"async\" alt=\"\" src=\"http:\/\/blogs.msdn.com\/Utility\/images\/star-left-on.png\" align=\"absmiddle\" border=\"0\" \/><img decoding=\"async\" alt=\"\" src=\"http:\/\/blogs.msdn.com\/Utility\/images\/star-right-on.png\" align=\"absmiddle\" border=\"0\" \/><img decoding=\"async\" alt=\"\" src=\"http:\/\/blogs.msdn.com\/Utility\/images\/star-left-on.png\" align=\"absmiddle\" border=\"0\" \/><img decoding=\"async\" alt=\"\" src=\"http:\/\/blogs.msdn.com\/Utility\/images\/star-right-on.png\" align=\"absmiddle\" border=\"0\" \/><img decoding=\"async\" alt=\"\" src=\"http:\/\/blogs.msdn.com\/Utility\/images\/star-left-on.png\" align=\"absmiddle\" border=\"0\" \/><img decoding=\"async\" alt=\"\" src=\"http:\/\/blogs.msdn.com\/Utility\/images\/star-right-on.png\" align=\"absmiddle\" border=\"0\" \/><img decoding=\"async\" alt=\"\" src=\"http:\/\/blogs.msdn.com\/Utility\/images\/star-left-on.png\" align=\"absmiddle\" border=\"0\" \/><img decoding=\"async\" alt=\"\" src=\"http:\/\/blogs.msdn.com\/Utility\/images\/star-right-off.png\" align=\"absmiddle\" border=\"0\" \/><\/div>\n<div><a href=\"http:\/\/blogs.msdn.com\/4122\/ProfileUrlRedirect.ashx\">Benjamin Armstrong<\/a><\/div>\n<div>25 Feb 2013 4:26 PM<\/div>\n<div><a href=\"http:\/\/blogs.msdn.com\/b\/virtual_pc_guy\/archive\/2013\/02\/25\/backing-up-hyper-v-virtual-machines-from-the-command-line.aspx?Redirected=true\">http:\/\/blogs.msdn.com\/b\/virtual_pc_guy\/archive\/2013\/02\/25\/backing-up-hyper-v-virtual-machines-from-the-command-line.aspx?Redirected=true<\/a><\/div>\n<div><!--more--><\/div>\n<div>\n<p>Last week I posted about how you can now use Windows Server Backup in Windows Server 2012 to backup virtual machines.\u00a0 One of the first questions that people had was \u201chow do I do this from the command-line?\u201d\u00a0 So \u2013 let me show you!<\/p>\n<p>The tool you will want to use is \u201cwbadmin.exe\u201d<\/p>\n<p>Backing up a virtual machine is fairly straight forward.\u00a0 Your command will look like this:<\/p>\n<p>wbadmin start backup \u2013backupTarget:&lt;location to backup to&gt; \u2013hyperv:&lt;list of virtual machines to backup&gt;<\/p>\n<p>Which will result in something like this:<\/p>\n<p><a href=\"http:\/\/blogs.msdn.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-41-22-metablogapi\/0572.image_5F00_04D50D90.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" alt=\"image\" src=\"http:\/\/blogs.msdn.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-41-22-metablogapi\/8715.image_5F00_thumb_5F00_52713A10.png\" width=\"681\" height=\"779\" border=\"0\" \/><\/a><\/p>\n<p>Some things to be aware of:<\/p>\n<ul>\n<li>Wbadmin will always warn you that the virtual machine will be put into a saved state for backup.\u00a0 This is wrong.\u00a0 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).<\/li>\n<li>You will be prompted before the backup starts.\u00a0 You can get around this by adding \u2013force to the end of the command.<\/li>\n<li>You can use either the virtual machine name or the virtual machine ID when selecting virtual machines.<\/li>\n<li>You can list multiple virtual machines to backup.<\/li>\n<li>If you are backing up to a SMB share \u2013 new backups will automatically overwrite old backups (i.e. there will only be one backup kept on the share).\u00a0 This will not happen if you are backing up to a local disk.<\/li>\n<\/ul>\n<p>Once you have created the backup \u2013 you then need to know how to restore it.\u00a0 This is, unfortunately, more complicated.\u00a0 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.\u00a0 You can find the version of the backup by running:<\/p>\n<p>wbadmin get versions \u2013backupTarget:&lt;location where you backed up to&gt;<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/blogs.msdn.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-41-22-metablogapi\/4113.image_5F00_36607B25.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" alt=\"image\" src=\"http:\/\/blogs.msdn.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-41-22-metablogapi\/5684.image_5F00_thumb_5F00_4432C120.png\" width=\"681\" height=\"370\" border=\"0\" \/><\/a><\/p>\n<p>If the backup was taken a while ago \u2013 you may have forgotten the name(s) of the virtual machines that you backed up.\u00a0 You can find this by running:<\/p>\n<p>wbadmin get items \u2013version:&lt;version string for the backup you want&gt; \u2013backuptarget:&lt;location where you backed up to&gt;<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/blogs.msdn.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-41-22-metablogapi\/6254.image_5F00_5205071B.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" alt=\"image\" src=\"http:\/\/blogs.msdn.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-41-22-metablogapi\/7725.image_5F00_thumb_5F00_1CF877EB.png\" width=\"682\" height=\"359\" border=\"0\" \/><\/a><\/p>\n<p>Once you have this information you can restore the backed up virtual machine by running:<\/p>\n<p>wbadmin start recover \u2013version:&lt;version string for the backup you want&gt; \u2013itemType:hyperv \u2013items:&lt;list of virtual machines to restore&gt; \u2013backuptarget:&lt;location where you backed up to&gt;<\/p>\n<p><a href=\"http:\/\/blogs.msdn.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-41-22-metablogapi\/8814.image_5F00_7CDD6B2D.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" alt=\"image\" src=\"http:\/\/blogs.msdn.com\/cfs-file.ashx\/__key\/communityserver-blogs-components-weblogfiles\/00-00-00-41-22-metablogapi\/5265.image_5F00_thumb_5F00_3CA751B3.png\" width=\"681\" height=\"1139\" border=\"0\" \/><\/a><\/p>\n<p>Cheers,<br \/>\nBen<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Backing up Hyper-V virtual machines from the command line RATE THIS Benjamin Armstrong 25 Feb 2013 4:26 PM http:\/\/blogs.msdn.com\/b\/virtual_pc_guy\/archive\/2013\/02\/25\/backing-up-hyper-v-virtual-machines-from-the-command-line.aspx?Redirected=true<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1201","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.wildow.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wildow.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wildow.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wildow.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wildow.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1201"}],"version-history":[{"count":1,"href":"https:\/\/www.wildow.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1201\/revisions"}],"predecessor-version":[{"id":1202,"href":"https:\/\/www.wildow.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1201\/revisions\/1202"}],"wp:attachment":[{"href":"https:\/\/www.wildow.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wildow.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wildow.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}