I am trying to make a post-job script that should:
==================================================
- eject a removable storage media (such as USB hard drives or RDX disks) right after a Backup Copy job finishes successfully
- disable the Backup Copy job right after it finishes in order to avoid the amount of notification emails for a Backup Copy job in the idle state because the repository isn't available since it has already been ejected
==================================================
Veeam Technical Support (Closed Case # 03033055) provided me with a link to the forum with similar problem. One of Veeam engineers advised some modification to the script in order to check that the job was actually doing something before disabling it.
Based om my experience so far with post-job scripts, I have noticed that they are so much more easier to implement with Backup jobs rather than Backup Copy jobs since Backup Copy jobs have a completely different logic. To be honest I didn't have any problems at all when using post-job scripts with Backup job.
I fully understand that Veeam does not support customer defined scripts, so I was wondering if someone has come up with a possible and reliable solution.
I have had some sort of success with the post-job script logic below in order to disable the Backup Copy job right after it finishes, but in many cases I haven’t:
Code: Select all
asnp VeeamPSSNapin
$Job = Get-VBRJob -name "Backup Copy Job 2 giornaliero VM di produzione"
$LastSession = $Job.FindLastSession()
#If (($LastSession.endtime.DayOfYear -eq (Get-date).DayOfYear) –and ($LastSession.State -eq "Success") -and ((($LastSession.endtime) - ($LastSession.creationtime)).Minutes -ge "10")) {$Job.DisableScheduler()}
If (($LastSession.endtime.DayOfYear -eq (Get-date).DayOfYear) -and ((($LastSession.endtime) - ($LastSession.creationtime)).Minutes -ge "10")) {
Disable-VBRJob -Job $job
}
Thanks and Regards,
Massimiliano