Excluding VMs under a Host

PowerShell script exchange

Excluding VMs under a Host

Veeam Logoby KRa » Wed Jan 04, 2012 8:43 pm

I'm trying to write a PowerShell script to exclude certain VMs from an existing backup job.
The problem I'm having is that the only object in the job list is a host, with all the VMs living underneath it.

Therefore, when I try to use:
Code: Select all
Remove-vbrJobObject -job $Job -Objects (Get-vbrJobObject -job $Job | Where {$_.Name -eq $VMName})

It does not see the VMs under the host, therefore I cannot parse them to return individual VMs using Get-VBRJobObject.

Is there a way to exclude the VMs under the host, without having to add each VM individually to the backup job?

Any help is greatly appreciated.
KRa
Lurker
 
Posts: 1
Liked: never
Joined: Wed Jan 04, 2012 7:52 pm

Re: Excluding VMs under a Host

Veeam Logoby McClane » Tue Mar 20, 2012 8:19 pm

I second that.
I would like to temporary exclude a single VM from a job, but the backup object list is a container usually.
McClane
Enthusiast
 
Posts: 91
Liked: 10 times
Joined: Sat Jun 20, 2009 12:47 pm

Re: Excluding VMs under a Host

Veeam Logoby Andreas Neufert » Wed Mar 28, 2012 10:35 pm

Not sure but give this a try. My lab isn´t available so I didn´t test this.
Remove-vbrJobObject -job $Job -Objects (Get-VBRJobObject -Name $VM)
Andreas Neufert
Veeam Software
 
Posts: 2201
Liked: 360 times
Joined: Wed May 04, 2011 8:36 am
Location: Germany
Full Name: @AndyandtheVMs Veeam PM

Re: Excluding VMs under a Host

Veeam Logoby ThomasMc » Sat Apr 21, 2012 1:39 pm

After having a good play around trying for this to work, I've found that it's a bit messy;

1. Create a temp job
2. Add the VM to the new job
3. Pull the object id
4. Create CObjectInJob
5. Delete the temp job
6. Add the CObjectInJob to the exclusion list of the original

of course this is all done by powershell so fully automated, if your interested I can finish the script off.
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 3 guests