PowerShell script exchange
Post Reply
yizhar
Service Provider
Posts: 181
Liked: 48 times
Joined: Sep 03, 2012 5:28 am
Full Name: Yizhar Hurwitz
Contact:

Veeam Backup Script to run multiple jobs in sequence

Post by yizhar »

HI.

Here is my simple three liner script that I use to run several jobs in sequence (one after the other),
and send a single summary report by email to the administrator.

Code: Select all


Add-PSSnapin VeeamPSSnapin
Get-VBRJob -name JOBNAME1,JOBNAME2,JOBNAME3 | Start-VBRJob | ft -AutoSize Name,State,CreationTime,EndTime,Result > LOGFILE.LOG
Send-MailMessage -To ADMIN@MY.DOMAIN -Subject Back-All-Daily -From VEEAM@MY.DOMAIN -SmtpServer MY.SMTP.SERVER -Body (Get-Content LOGFILE.LOG | out-string)

Notes:
You should obviously change some values to suite your needs and preferences.
Look for those in CAPS, for example:
JOBNAME1,JOBNAME2,JOBNAME3
LOGFILE.LOG (make sure to use the same logfile name in 2nd and 3rd lines, I also recommend using full path such as C:\Batch\backup.log).
ADMIN@MY.DOMAIN
VEEAM@MY.DOMAIN
MY.SMTP.SERVER

Enjoy it.
Yizhar Hurwitz
New Ofek
Israel
Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests