Exclude Object in job

PowerShell script exchange

Exclude Object in job

Veeam Logoby oz07 » Fri Dec 09, 2011 1:05 pm

Hello,

Is it possible to exclude an object in job ?

I can add an VM in a job with this command Add-VBRJobObject -Job $job -Server $vcenter -Object $object
But how to exclude this object in the job ?
oz07
Lurker
 
Posts: 1
Liked: never
Joined: Fri Dec 09, 2011 1:01 pm

Re: Exclude Object in job

Veeam Logoby ThomasMc » Fri Dec 09, 2011 2:45 pm

Sure is

Code: Select all
$job = Get-VBRJob -Name "Job Name"
$obj = $job | Get-VBRJobObject
$exclude = $obj | ?{$_.Name -eq "VM to Exclude"}

Remove-VBRJobObject -Job $job -Object $exclude


The VM will still be in the job and a a exclusion rule will get applied
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: Exclude Object in job

Veeam Logoby ThomasMc » Fri Dec 09, 2011 6:11 pm

And a v6 one :)

Code: Select all
Get-VBRJob -Name "Job Name" | Get-VBRJobObject -Name "VMToExclude" | Remove-VBRJobObject
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: Exclude Object in job

Veeam Logoby Gostev » Fri Dec 09, 2011 11:58 pm

I must admit I like v6 PowerShell so much better :D
Gostev
Veeam Software
 
Posts: 21390
Liked: 2349 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 3 guests