Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to set up a script to run the backups of my Virtual Machines only using WBADMIN, I've got as fas as being able to backup all the VMs using the new -HyperV switch, however I also want to backup the HyperV Host Component. Does anyone have any experience in doing this or can point me to some documentation (the Microsoft one neglects this new -HyperV switch)

This is my powershell script if your interested:

#Constant Variables
$Day = Get-Date
$Day = $Day.DayOfWeek
$Date = Get-Date -format hhmmddMMyyyy
$Server = hostname

#Set Paths
$BackupPath =  "\\backup\Backups\" + $Server + "\" +$Day
$LogPath = "\\backup\Backups\" + $Server + "\Logs\" + $Date +".txt"

# SELECT Virtual Machines
$VMList = $null
$VMs = Get-VM | Select-Object VMId
for ($i = 0 ; $i -lt $VMs.length ; $i++) {
    $VMList = $VMList + '"' + $VMs[$i].VMId + '"' +","
$VMList =  $VMList.Substring(0,$VMList.Length - 1)

#Run Backup
WBADMIN START BACKUP -backupTarget:$BackupPath -hyperv:$VMList -Quiet
share|improve this question
Good question. I see the gui choice, but nothing yet related to wbadmin cli. – TheCleaner May 23 '13 at 13:15
Ok so I've found some actual microsoft documentation on this but it still doesn't mention the 'host component'. While its not the end of the world as all of my hosts are identical it would be easier to be able to restore it if required!… – Harrison May 30 '13 at 19:13
up vote 0 down vote accepted

So i finally figured out that you need to ditch WBADMIN and start using the WBbackup CMDLETS in powershell instead, heres how you can do it

#Constant Variables
$Day = Get-Date
   #Use this for Backups in Evening
    $Day = ($Day.AddDays(1)).DayOfWeek

    #Use this for Backups in the Morning
    #$Day = $Day.DayOfWeek

$Date = Get-Date -format hhmmddMMyyyy
$Server = hostname
$Target = '\\backup\backups\'+$Server+'\'+$Day
$VirtualMachines = Get-WBVirtualMachine

$DailyFullWB = New-WBPolicy
$BackupTarget = New-WBBackupTarget -NetworkPath $Target
Set-WBPolicy -Policy $DailyFullWB
Add-WBBackupTarget -Policy $DailyFullWB -Target $BackupTarget -Force
Add-WBVirtualMachine -Policy $DailyFullWB -VirtualMachine $VirtualMachines
Start-WBBackup -Policy $DailyFullWB -AllowDeleteOldBackups -Force    
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.