Veeam Backup & Replication – Backup single VM from backup job

Veeam Backup & Replication – Backup single VM from backup job

If you need backup/replicate only one or more VM from backup/replication job you can use PowerShell with VeeamPSSnapIn. On Veeam Backup & Replication server open PowerShell ISE under administrator account and use this script.

please do not stop powershell script prematurely, because the last selection of script re-add your jobs to backup job „Delete the exclude objects and re-add to job“

Before run scrip… please backup your VBR settings and jobs.

#* Load Veeam snapin
Add-PsSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue

#* User Input
$jobName = Read-Host "Enter Job Name"
$vmName = Read-Host "Enter VM Name"


#* Find the job that has our VM
$job = Get-VBRJob | ?{$_.Name -eq $jobName}

#* Get all objects in job apart from our target VM
$execObjs = $job.GetObjectsInJob() | ?{$_.Name -ne $vmName}

#* Exclude the objects from the job(*Note: this isn't removing the objects
#* from the job)
Remove-VBRJobObject -Objects $execObjs

#* Start the job only backing up the target VM
Start-VBRJob -Job $job

#* Find the exclude job objects
$incObjs = $job.GetObjectsInJob() | ?{$_.Type -eq "Exclude"}

#* Delete the exclude objects and re-add to job
foreach ($obj in $incObjs) {
   $Excitem = $obj.GetObject().GetItem()
    Add-VBRViJobObject -job $Job -Entities $Excitem
   $obj.Delete() | Out-Null
}

You must specify name of Backup Job and name of VM, which you need backup/replicate.

source

 

(Visited 583 times, 1 visits today)

Napsat komentář

Vaše e-mailová adresa nebude zveřejněna. Vyžadované informace jsou označeny *