PowerShell script exchange
Post Reply
oz07
Service Provider
Posts: 1
Liked: never
Joined: Dec 09, 2011 1:01 pm
Contact:

Exclude Object in job

Post by oz07 »

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 ?

ThomasMc
Expert
Posts: 293
Liked: 18 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: Exclude Object in job

Post by ThomasMc »

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: 18 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: Exclude Object in job

Post by ThomasMc »

And a v6 one :)

Code: Select all

Get-VBRJob -Name "Job Name" | Get-VBRJobObject -Name "VMToExclude" | Remove-VBRJobObject

Gostev
SVP, Product Management
Posts: 26701
Liked: 4276 times
Joined: Jan 01, 2006 1:01 am
Location: Baar, Switzerland
Contact:

Re: Exclude Object in job

Post by Gostev »

I must admit I like v6 PowerShell so much better :D

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests