Hi,
I have a backup Job A with 12 VMs in it, I also have a Job B with 37 vms in it and some VMs (around 10) in job b have disk exclusions configured.
Is there a way to move vms from Job B to Job A with a power shell script and retain all exclusions as they are?
The final goal is to consolidate A and B in to just one Job A
Thank you
-
- Expert
- Posts: 162
- Liked: 18 times
- Joined: Feb 08, 2018 3:47 am
- Full Name: Kazz Beck
- Contact:
-
- Veeam Software
- Posts: 2015
- Liked: 671 times
- Joined: Sep 25, 2019 10:32 am
- Full Name: Oleg Feoktistov
- Contact:
Re: move vms with exclusions script
Hi,
Yes, you would need to add VMs as new job objects to a target job and then update each of them with the exclusion data from the source job. An example for vSphere backup jobs:
This script will loop through each of objects of a source job you want to move the vms from, add and then update each of them in the target job separately. I'm using a conjunction of object name and vm reference on the vSphere infrastructure to filter each vm to avoid dealing with duplicated names.
Let me know if it helps,
Oleg
Yes, you would need to add VMs as new job objects to a target job and then update each of them with the exclusion data from the source job. An example for vSphere backup jobs:
Code: Select all
$targetJob = Get-VBRJob -Name 'Backup Job 1'
$sourceJob = Get-VBRJob -Name 'Backup Job 2'
$objects = Get-VBRJobObject -Job $sourceJob
foreach ($object in $objects) {
$entity = Find-VBRViEntity -Name $object.Name -Server vsphere.local | where {$_.Reference -eq $object.Object.ObjectRef}
Add-VBRViJobObject -Job $targetJob -Entities $entity
$targetJob = Get-VBRJob -Name 'Backup Job 1'
$targetObject = Get-VBRJobObject -Job $targetJob -Name $object.Name | where {$_.Object.ObjectRef -eq $object.Object.ObjectRef}
$targetObject.Update($object.VssOptions, $object.DiskFilterInfo, $object.UpdateConfig, $object.Type)
}
Let me know if it helps,
Oleg
-
- Expert
- Posts: 162
- Liked: 18 times
- Joined: Feb 08, 2018 3:47 am
- Full Name: Kazz Beck
- Contact:
Re: move vms with exclusions script
Thanks Oleg!
I was able to scrip the move of the VMs but without the exclusions. This is super helpful, thanks again!
I was able to scrip the move of the VMs but without the exclusions. This is super helpful, thanks again!
Who is online
Users browsing this forum: No registered users and 14 guests