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
Veteran
Posts: 293
Liked: 19 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
Veteran
Posts: 293
Liked: 19 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
Chief Product Officer
Posts: 31814
Liked: 7302 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 5 guests