PowerShell script exchange
Post Reply
tom_nl
Enthusiast
Posts: 43
Liked: 7 times
Joined: Nov 02, 2018 9:13 am
Contact:

Adding Application Aware Processing exclusions

Post by tom_nl »

Hi,

I currently have a script which automates the configuration of a Veeam server.
In the job I add the vCenter as object, so the job will backup every VM under the vCenter, and thus also newly created VM's later on.

However for some VM's I want to disable application aware processing.

Below is the script that I have now:

Code: Select all

$vssoptions = New-VBRJobVssOptions
$vssoptions.Enabled = $False
Get-VBRJob -Name "job name" | Get-VBRJobObject -Name "example_VM" | Set-VBRJobObjectVssOptions -Options $vssoptions
However, because I added only the vCenter to job, the "Get-VBRJobObject" doesn't return any VM's. It only returns the vCenter.

How can I solve this?
Adding all the VM's to job individually is not really an option for me.
HannesK
Product Manager
Posts: 14319
Liked: 2890 times
Joined: Sep 01, 2014 11:46 am
Full Name: Hannes Kasparick
Location: Austria
Contact:

Re: Adding Application Aware Processing exclusions

Post by HannesK »

Hello,
to disable VSS for some VMs you need to add them to the backup job as single machines additionally. You can add VCenter and individual VMs twice. Veeam will detect that the machine exists as "single machine" and inside the "VCenter" container (no double backup). But it will take the "more precise" settings of the single machine.

Best regards,
Hannes
tom_nl
Enthusiast
Posts: 43
Liked: 7 times
Joined: Nov 02, 2018 9:13 am
Contact:

Re: Adding Application Aware Processing exclusions

Post by tom_nl »

Ok. That's kinda weird, because in the interface you can do that without adding the VM's individually to the job.
HannesK
Product Manager
Posts: 14319
Liked: 2890 times
Joined: Sep 01, 2014 11:46 am
Full Name: Hannes Kasparick
Location: Austria
Contact:

Re: Adding Application Aware Processing exclusions

Post by HannesK »

ah, sorry, my idea was for disk exclusions.

but even for guest processing, you need to add the VM in the AAIP settings again
Image

If you add them to the VMs in the earlier step, then they are already available in the AAIP screenshot above.
tom_nl
Enthusiast
Posts: 43
Liked: 7 times
Joined: Nov 02, 2018 9:13 am
Contact:

Re: Adding Application Aware Processing exclusions

Post by tom_nl »

I understand what you mean.

But in the GUI I can add seperate VM's in the Application-Aware processing, without adding them separately to the virtual machines in the job.

With PowerShell I can't do that.
tsightler
VP, Product Management
Posts: 6012
Liked: 2843 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: Adding Application Aware Processing exclusions

Post by tsightler » 1 person likes this post

It is actually possible to do this via Powershell. The only difference between an object that appears in the "VMs to backup" list vs the "Application Aware Processing" list is the "type" field of the object-in-job object (wow, that's weird to type). If the OIJ object is of type "Include" it will appear in both list in the GUI, while an object of type "VssChild" appears only in the AAIP list because, as it's name implies, it is a considered a child object of the included objects used to override values. When you do this in the GUI from the AAIP screen the object is added immediately with the "VssChild" type set.

However, in Powershell, it is still possible, but you have to add the VM to the job using the standard cmdlet, which temporarily adds it as an "Include" object, but then you change it's "Type" property value to "VssChild". This will keep the object from appearing in the 'VMs to backup" list but the object will still show in the "Application-Aware" list and you can override the AAIP options for this child object.

Here's a crude example:

Code: Select all

$vm = "testvm"
$vmentity = Find-VBRViEntity -Name $vm
$job = Get-VBRJob -Name "Test Job"

# Add the VM entity to the job
Add-VBRViJobObject -Job $job -Entities $vmentity

# Get the job object for the newly added VM 
$newoij = Get-VBRJobObject -Job $Job -Name $vm.Name

# Change the job object type from "Include" to "VssChild" and resave the object
$newoij.Info.Type = [Veeam.Backup.Model.CDbObjectInJobInfo+EType]::VssChild
Set-VBRJobObjectVssOptions -Object $newoij -Credentials $cred
Let me know if you have any questions.
tom_nl
Enthusiast
Posts: 43
Liked: 7 times
Joined: Nov 02, 2018 9:13 am
Contact:

Re: Adding Application Aware Processing exclusions

Post by tom_nl »

Hi,

I have tried your example, but I get the following error:

Code: Select all

The property 'Type' cannot be found on this object. Verify that the property exists and can be set.

+    $newoij.Info.Type = [Veeam.Backup.Model.CDbObjectInJobInfo+EType]: ...
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException
Any idea?
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Adding Application Aware Processing exclusions

Post by oleg.feoktistov »

Hi,

That's weird. I tried to apply the same in my lab and it worked for me.
After you made it through the steps below,

Code: Select all

$vm = "testvm"
$vmentity = Find-VBRViEntity -Name $vm
$job = Get-VBRJob -Name "Test Job"

# Add the VM entity to the job
Add-VBRViJobObject -Job $job -Entities $vmentity

# Get the job object for the newly added VM 
$newoij = Get-VBRJobObject -Job $Job -Name $vm.Name
do you see Type property in the output if you call $newoij.Info ?
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Adding Application Aware Processing exclusions

Post by oleg.feoktistov »

Also, please, check the script running each line separately to find the error's origin. Thanks.
tom_nl
Enthusiast
Posts: 43
Liked: 7 times
Joined: Nov 02, 2018 9:13 am
Contact:

Re: Adding Application Aware Processing exclusions

Post by tom_nl » 2 people like this post

I got it working.
I was working with wildcards, so the Find-VBRViEntity returned multiple VM's, which needed some modifications :)
Thanks for the help.
Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests