[Feature/Solution request]Surebackup After this Job

PowerShell script exchange

[Feature/Solution request]Surebackup After this Job

Veeam Logoby VladV » Tue Sep 24, 2013 1:56 pm

I have been running a Robocopy script as a post job activity triggered by the last full backup on Saturday. The script simply checks if the job that triggers it finished with a success status and then proceeds.

I now want to run a Surebackup job on Saturday, after the last backup, that checks all the full backups and if successful, runs the robocopy task.

To accomplish this I was hoping to be able to schedule the Surebackup job to run after the last backup job, only on Saturday, but you can only specify after which job to run. That approach wasn't going to work so I wrote a short script that starts the Surebackup job as a post job activity for the last backup only Saturday. Now I only needed to add the Robocopy script to run after the Surebackup Job which I cannot because Surebackup doesn't have a post job activity.

Is it possible to continue running commands in the PS script after executing the Surebackup job?

Example:
Code: Select all
Add-PsSnapin VeeamPSSnapIn
$Job = Get-VBRJob -name "Server-et"
$StartTime = $Job.FindLastSession().CreationTime
   If ($Job.GetLastresult() -eq "Warning" -or $Job.GetLastresult() -eq "Success")
   {
   $JobSurebackup = Get-VSBJob -name "SureBackup_1"
   Start-VSBJob $JobSurebackup

 >>Insert robocopy script here<<

   }
   ELSE
   {
   & 'c:\program files\veeam\scripts\sendmailfailed3.ps1'
   }


If not can anyone help me accomplish this? I mean, what's the point in copying the full backups if they don't pass a surebackup task.



Regards,
Vlad
VladV
Expert
 
Posts: 214
Liked: 24 times
Joined: Tue Apr 30, 2013 7:38 am
Full Name: Vlad Valeriu Velciu

Re: [Feature/Solution request]Surebackup After this Job

Veeam Logoby v.Eremin » Tue Sep 24, 2013 2:09 pm

Is it possible to continue running commands in the PS script after executing the Surebackup job?

Yep, as long as you don’t use -RunAsync parameter the script will wait till the SureBackup is finished, and only, then, proceed to the other lines. So, all you need to do is to add required Robocopy lines to the script body. Thanks.
v.Eremin
Veeam Software
 
Posts: 13296
Liked: 974 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 3 guests