PowerShell script exchange
Post Reply
mdiver
Veeam Legend
Posts: 201
Liked: 33 times
Joined: Nov 04, 2009 2:08 pm
Location: Heidelberg, Germany
Contact:

Best practice manipulating VSS settings for agent jobs

Post by mdiver »

There seems to be a shift in the PS API to a new object model:
powershell-f26/v11-get-vbrbackupreposit ... ml#p403269

To change guest processing options within agent jobs we try to use the methods behind:
https://helpcenter.veeam.com/docs/backu ... ml?ver=110

Code: Select all

$Obj = Get-VBRDiscoveredComputer -ProtectionGroup "MyProtectionGroup" |Where-Object name -match "MyServer"
$SQLVSSOptions = New-VBRSQLProcessingOptions -TransactionAction BackupPeriodically -LogBackupPeriod 10 -LogRetainAction KeepOnlyLastDays -LogRetainPeriod 5
$VSSOptions=New-VBRApplicationProcessingOptions -BackupObject $Obj -OSPlatform "Windows" -Enable -GeneralTransactionLogAction ProcessLogsWithJob -SQLProcessingOptions $SQLVSSOptions
Set-VBRApplicationProcessingOptions -Options $VSSOptions  -GeneralTransactionLogAction PerformCopyOnly -Enable 
Though I do not see the changes we can push via these methods within the jobs.
Also I don't find any method here to read the settings from a job. Only "New-" and "Set-" methods. No "Get-".

In contrast I can use the methods behind:
https://helpcenter.veeam.com/docs/backu ... ml?ver=110

To read out and manipulate the settings. These methods are not meant for agent jobs as I undestand it.

Can someone provide a working snippet to manipulate VSS settings for a machine within an agent job?

Thanks,
Mike
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Best practice manipulating VSS settings for agent jobs

Post by oleg.feoktistov » 1 person likes this post

Hi,

It is, indeed, works a bit differently here. Unlike in the obsolete API, we push changes to a job with Set-VBRComputerBackupJob cmdlet.
And to get current job settings, just use Get-VBRComputerBackupJob cmdlet and then access the needed settings object one level down. Example of changing the existing settings:

Code: Select all

$job = Get-VBRComputerBackupJob -Name 'Windows Agent Backup Job'
$appOptions = $job.ApplicationProcessingOptions
$computer = Get-VBRDiscoveredComputer -Type Computer
$newAppOptions = Set-VBRApplicationProcessingOptions -Options $appOptions[0] -Enable -GeneralTransactionLogAction PerformCopyOnly
Set-VBRComputerBackupJob -Job $job -EnableApplicationProcessing -ApplicationProcessingOptions $newAppOptions
Thanks,
Oleg
mdiver
Veeam Legend
Posts: 201
Liked: 33 times
Joined: Nov 04, 2009 2:08 pm
Location: Heidelberg, Germany
Contact:

Re: Best practice manipulating VSS settings for agent jobs

Post by mdiver »

Hi Oleg.

Thanks for your comprehensive response. Works perfectly. I could also include VBRSQLProcessingOptions as planned.
A deep dive about the new API would IMHO be a great idea for the upcoming VeeamON.

Thanks,
Mike
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Best practice manipulating VSS settings for agent jobs

Post by oleg.feoktistov »

Glad to help! Yes, I think at some point it would be worth showing the line between old and new api. Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests