PowerShell script exchange
Post Reply
pbuchin
Lurker
Posts: 1
Liked: never
Joined: Jul 30, 2015 8:07 pm
Full Name: Patrick Buchin
Contact:

Set exclusions for VMs by tag

Post by pbuchin »

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
veremin
Product Manager
Posts: 20413
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Set exclusions for VMs by tag

Post by veremin »

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.
Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests