Let me start out with some background information. The company i work for have quite a large Veeam environment (in short 4 backup servers, 500 jobs and close to 1000vm's). From time to time we have noticed our servers where under heavy load, one day it escalated and resulted in some failed jobs that we had to restart after the load had dropped to normal. Experiencing this we had to investigate further, and one of my colleagues suspected it could be that a large number of our jobs was set to do a full backup and/or compacting backup files on the same time.
Being human, you intend to repeat what you are doing on a daily basis IE, copying existing jobs when you implement a new
So i wrote a Powershell script to browse through all our backup jobs (on one server only, modify it to connect to other servers as well) an look for when the jobs is set to compact files, and when they are scheduled to do, in our case, their monthly full backup. Probably not the nicest PS script you have seen, but it does the job.
Code: Select all
#load veeam ps snapin
Add-PSSnapin VeeamPSSnapin
#add get to variable an loop through evry job
$Job = Get-VBRJob
foreach ($Object in $Job)
{
$options = $Object.getoptions() #job options variable
$query = $options.GenerationPolicy.CompactFullBackupMonthlyScheduleOptions #Variable for compact schedule
$query2 = $options.BackupTargetOptions.FullBackupMonthlyScheduleOptions #Variable for full backup
$dayofweek1 = $query.DayOfWeek #Get day of week from compact
$dayofweek2 = $query.DayNumberInMonth #get day of month ie, first second etc
$dayofmonth = $query2.DayNumberInMonth #day of week for full backup
$dayofmonth2 = $query2.DayOfWeek #day of month for full backup
[string]$compactday = $dayofweek2, $dayofweek1 #combine in a string to list "first monday" in column
[string]$fullmonth = $dayofmonth, $dayofmonth2 #combine in a string to list "first monday" in column
New-Object psobject -Property @{
"Compacting" = $compactday
"Name" = $Object.Name
"FullBackup" = $fullmonth
} | Select-Object Name,Compacting,FullBackup #remove this to, | export-csv -Path \\your-path\file.csv -Append
}
Code: Select all
Name Compacting FullBackup
---- ---------- ----------
JOB NAME First Monday Third Wednesday
JOB NAME First Monday First Monday
JOB NAME First Saturday First Monday
JOB NAME First Saturday First Monday
JOB NAME First Monday First Monday
JOB NAME First Monday Third Thursday
Martin