Remove exclusions

PowerShell script exchange

Remove exclusions

Veeam Logoby daphnis » Mon May 22, 2017 2:09 am

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: Wed Jun 13, 2012 7:01 pm

Re: Remove exclusions

Veeam Logoby daphnis » Mon May 22, 2017 6:38 pm

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.
daphnis
Enthusiast
 
Posts: 47
Liked: 3 times
Joined: Wed Jun 13, 2012 7:01 pm

Re: Remove exclusions

Veeam Logoby tsightler » Mon May 22, 2017 8:41 pm

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.
tsightler
Veeam Software
 
Posts: 4872
Liked: 1821 times
Joined: Fri Jun 05, 2009 12:57 pm
Full Name: Tom Sightler

Re: Remove exclusions

Veeam Logoby daphnis » Mon May 22, 2017 8:47 pm

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: Wed Jun 13, 2012 7:01 pm

Re: Remove exclusions

Veeam Logoby daphnis » Mon May 22, 2017 11:58 pm

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.
daphnis
Enthusiast
 
Posts: 47
Liked: 3 times
Joined: Wed Jun 13, 2012 7:01 pm

Re: Remove exclusions

Veeam Logoby tsightler » Tue May 23, 2017 12:19 am

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.
tsightler
Veeam Software
 
Posts: 4872
Liked: 1821 times
Joined: Fri Jun 05, 2009 12:57 pm
Full Name: Tom Sightler

Re: Remove exclusions

Veeam Logoby daphnis » Wed May 24, 2017 1:29 am

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.
daphnis
Enthusiast
 
Posts: 47
Liked: 3 times
Joined: Wed Jun 13, 2012 7:01 pm

Re: Remove exclusions

Veeam Logoby tsightler » Wed May 24, 2017 1:46 am

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.
tsightler
Veeam Software
 
Posts: 4872
Liked: 1821 times
Joined: Fri Jun 05, 2009 12:57 pm
Full Name: Tom Sightler


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 1 guest