PowerShell script exchange
Post Reply
VladV
Expert
Posts: 224
Liked: 25 times
Joined: Apr 30, 2013 7:38 am
Full Name: Vlad Valeriu Velciu
Contact:

[Feature/Solution request]Surebackup After this Job

Post by VladV »

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
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

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

Post by veremin »

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.
Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests