Set exclusions for VMs by tag

PowerShell script exchange

Set exclusions for VMs by tag

Veeam Logoby pbuchin » Thu Jul 30, 2015 8:22 pm

Hi guys,

in our environment we build veeam backup jobs by vmware datastores and exclusions of some vms are made with tags on the vm. Now I configured the exclusion on one job and would like to copy these to all the other jobs. But my Powershell script doesn't work (no errors are shown). Has someone an idea where is my wrong in this script:

Code: Select all
asnp veeampssnapin
$job_source = Get-VBRJob -Name "source_job"
$job_destination = Get-VBRJob -Name "destination_job"
$incObjs = $job_source.GetObjectsInJob() | ?{$_.Type -eq "Exclude"}
$server = Get-VBRServer | where {$_.name -like "vcenter"}
Add-VBRJobObject ($job_destination) -Server ($server) -Objects ($incObjs)


Or someone know how I can set a new exclusion using VM tags?

Greetings and thanks,

Patrick
pbuchin
Lurker
 
Posts: 1
Liked: never
Joined: Thu Jul 30, 2015 8:07 pm
Full Name: Patrick Buchin

Re: Set exclusions for VMs by tag

Veeam Logoby v.Eremin » Mon Aug 03, 2015 12:33 pm

Or someone know how I can set a new exclusion using VM tags?

Find VMs that have specific tag, using PowerCLI, query a backup job, find job objects that have the same name as VMs with corresponding tag and exclude those, leveraging Remove-VBRJobObject.

The script provided by you should not work, as it uses a different logic than the one I've described, as well as, obsolete commandlet Add-VBRJobObject that has been replaced already by Add-VBRViJobObject and Add-VBRHvJobObject ones.

Thanks.
v.Eremin
Veeam Software
 
Posts: 13281
Liked: 970 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 7 guests