PowerShell script exchange
Post Reply
daphnis
Enthusiast
Posts: 47
Liked: 3 times
Joined: Jun 13, 2012 7:01 pm
Contact:

Remove exclusions

Post by daphnis »

I don't see a cmdlet which has the ability to remove items from the exclusions list, specifically VMs. There is a way to add items to this list (Remove-VBRJobObject), but not remove them so far as I can tell. Has anyone find a way to do this?
daphnis
Enthusiast
Posts: 47
Liked: 3 times
Joined: Jun 13, 2012 7:01 pm
Contact:

Re: Remove exclusions

Post by daphnis »

I opened a support case on this question and was told functionality does not currently exist. Let me express desire in such a feature in future versions.
tsightler
VP, Product Management
Posts: 6009
Liked: 2843 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: Remove exclusions

Post by tsightler »

You don't really remove them from the list, you just delete the objects from the job and thus they aren't on the exclusion list anymore.
daphnis
Enthusiast
Posts: 47
Liked: 3 times
Joined: Jun 13, 2012 7:01 pm
Contact:

Re: Remove exclusions

Post by daphnis »

I don't want to remove them from the job, I just want to exclude them from the job thus keeping them in the configuration.
daphnis
Enthusiast
Posts: 47
Liked: 3 times
Joined: Jun 13, 2012 7:01 pm
Contact:

Re: Remove exclusions

Post by daphnis »

I get what you are saying now. I was confused at first. If you have VMs in a job directly (not in a container) and you exclude one via PowerShell, it gets moved to the exclusions list. But if you then delete that from the exclusions list, it's gone from the job at that point. I think the workaround here is to add a container and not individual VMs.
tsightler
VP, Product Management
Posts: 6009
Liked: 2843 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: Remove exclusions

Post by tsightler »

daphnis wrote:I don't want to remove them from the job, I just want to exclude them from the job thus keeping them in the configuration.
There may be some miscommunication here, but I understood that you already knew how to do this based on your OP, you simply use Remove-VBRJobObject to add a VM to the exclusion list. To include them back in the job you have the add the VM back to the job include list (assuming it's not already part of a container object selected in the job), and delete the VM from the exclude list. Perhaps some code examples will help:

Add new VM to Job (VM in inclusion list):

Code: Select all

$jobname = "<Job_Name>"
$vmname = "<VM_Name>"
Add-VBRViJobObject -Job $jobname -Entities (Find-VBRViEntity -Name $vmname)
Specifically exclude the VM from the job (VM in exclusion list):

Code: Select all

Get-VBRJobObject -Job $jobname -Name $vmname | Remove-VBRJobObject
Add excluded VM back to job (inclusion list) and then delete VM exclude object from exclusion list (VM will be back in inclusion list):

Code: Select all

Add-VBRViJobObject -Job $jobname -Entities (Find-VBRViEntity -Name $vmname)
Get-VBRJobObject -Job $jobname -Name $vmname | ?{$_.Type -eq "Exclude" } | Remove-VBRJobObject -Completely
If this is still not what you are looking for perhaps you can describe specifically what you are trying to accomplish, including the steps you would use in the GUI.
daphnis
Enthusiast
Posts: 47
Liked: 3 times
Joined: Jun 13, 2012 7:01 pm
Contact:

Re: Remove exclusions

Post by daphnis »

Thanks for your reply. When a container is added to a job (ex., a VM folder) and an exclusion is made, the matter is simple: just delete the VM from the exclusions list (job). But I was attempting to add VMs explicitly and individually. In that case, when you exclude one of those VMs (which cannot be done in the GUI, by the way), it is effectively "moved" to the exclusions list. If you remove it from the exclusions list (i.e., job), then it ceases to be in the job configuration and will not be backed up. That's different behavior when compared to adding a container. I think the best thing programmatically in this case is to strive to add a container over individual VMs.
tsightler
VP, Product Management
Posts: 6009
Liked: 2843 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: Remove exclusions

Post by tsightler »

My example above is specifically with just individual VMs. As noted you just add the VM back to the include list and delete the existing entry from the exclude list. Yes, there's no single cmdlet, but it gets the job done and works just fine.
Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests