Veeam | Get backup settings with powershell

By | 30 juni 2014

I needed to check the backup ‘settings’ from a bunch of backup jobs within Veeam, and doing them manually is a waste of time.

So i made a little powershell script to do it. This is one of the first times i’m using powershell, so it probably could be optimized.

if((Get-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue) -eq $null){
    Add-PSSnapin "VeeamPSSnapIn"
}

$JobInfo = @()
foreach($vbrJob in (Get-VBRJob | Sort Name)){
    foreach($Object in (Get-VBRJobObject -Job $vbrJob | Sort Name)){
       $Details = "" | Select JobName,ObjectSizeinGB,Algorithm,RetainCycles,RetainDays,CompressionLevel,ChangedBlockTracking,ExcludeSwapFile,EnableDeduplication,SourceProxyAutoDetect,EnableIntegrityChecks,SetResultsToVmNotes
       $JobSize = ([math]::Round($Object.Info.ApproxSize / 1GB))
    
       $Details.JobName = $vbrJob.Name
    
       $Details.ObjectSizeinGB = $JobSize

       $JobnameObject = Get-VBRJob | Where {$_.Name -eq $vbrJob.Name}
       $Options = $JobnameObject.GetOptions()

       # Determine what kinda job this is
       if ($Options.Options.RootNode.Algorithm -eq "Syntethic"){
          $Algorithm = "Reversed Incremental"
       }
       if ($Options.Options.RootNode.Algorithm -eq "Increment") {
          if ($Options.Options.RootNode.TransformFullToSyntethic -eq "True" -And $Options.Options.RootNode.TransformIncrementsToSyntethic -eq "True") {
             $Algorithm = "Incremental ( Synthetic full enabled, Transform previous full backup chains into rollbacks )"
          }
          if ($Options.Options.RootNode.TransformFullToSyntethic -eq "True" -And $Options.Options.RootNode.TransformIncrementsToSyntethic -eq "False") {
             $Algorithm = "Incremental ( Synthetic full enabled )"
          }
          if ($Options.Options.RootNode.TransformFullToSyntethic -eq "False" -And $Options.Options.RootNode.TransformIncrementsToSyntethic -eq "False") {
             $Algorithm = "Incremental ( Synthetic full disabled, Active full backups )"
          }
       }

       # Detect if Changed Block Tracking is enabled
       if ($Options.Options.RootNode.UseChangeTracking -eq "True" -And $Options.Options.RootNode.EnableChangeTracking -eq "True") {
          $CBT = "Enabled"
       } else { $CBT = "Disabled" }

       # Detect if the swap file is excluded
       if ($Options.Options.RootNode.ExcludeSwapFile -eq "True") {
          $swap = "Enabled"
       } else { $swap = "Disabled" }

       # Detect if inline Deduplication is enabled
       if ($Options.Options.RootNode.EnableDeduplication -eq "True") {
          $dedup = "Enabled"
       } else { $dedup = "Disabled" }

       # Detect if SourceProxyAutoDetect is Automatically Selected
       if ($Options.Options.RootNode.SourceProxyAutoDetect -eq "True") {
          $backupproxy = "Automatic selection"
       } else { $backupproxy = $Options.Options.RootNode.SourceProxyAutoDetect }

       # Detect if Integrity Checks are enabled
       if ($Options.Options.RootNode.EnableIntegrityChecks -eq "True") {
          $integrity = "Enabled"
       } else { $integrity = "Disabled" }

       # Detect if Results To Vm Notes are enabled
       if ($Options.Options.RootNode.SetResultsToVmNotes -eq "True") {
          $notes = "Enabled"
       } else { $notes = "Disabled" }

       $RetainDays	     	 = $Options.Options.RootNode.RetainDays
       $Details.Algorithm    	 = $Algorithm
       $Details.RetainCycles 	 = $Options.Options.RootNode.RetainCycles
       $Details.CompressionLevel = $Options.Options.RootNode.CompressionLevel
       $Details.RetainDays   	 = "Remove deleted VMs data from backup after $RetainDays days"
       $Details.ChangedBlockTracking = $CBT
       $Details.ExcludeSwapFile  = $swap
       $Details.EnableDeduplication = $dedup
       $Details.SourceProxyAutoDetect = $backupproxy
       $Details.EnableIntegrityChecks = $integrity
       $Details.SetResultsToVmNotes = $notes
    }

    $Details 

}
Exit

The output :

JobName               : Job01
ObjectSizeinGB        : 409
Algorithm             : Incremental ( Synthetic full enabled )
RetainCycles          : 14
RetainDays            : Remove deleted VMs data from backup after 14 days
CompressionLevel      : 6
ChangedBlockTracking  : Enabled
ExcludeSwapFile       : Enabled
EnableDeduplication   : Enabled
SourceProxyAutoDetect : Automatic selection
EnableIntegrityChecks : Enabled
SetResultsToVmNotes   : Enabled

JobName               : Job02
ObjectSizeinGB        : 9
Algorithm             : Reversed Incremental
RetainCycles          : 30
RetainDays            : Remove deleted VMs data from backup after 30 days
CompressionLevel      : 6
ChangedBlockTracking  : Enabled
ExcludeSwapFile       : Enabled
EnableDeduplication   : Enabled
SourceProxyAutoDetect : Automatic selection
EnableIntegrityChecks : Enabled
SetResultsToVmNotes   : Enabled

One thought on “Veeam | Get backup settings with powershell

  1. Andi

    Hi there.
    Thank you very much for sharing this. I am already searching for a while to find that specific information.
    First I tought i can easily get this via get-vbrjob but sadly it isn not that easy 🙂

    So, thanks again! Nice job.

    Reply

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *