PowerShell script exchange
Post Reply
jcwuerfl
Enthusiast
Posts: 44
Liked: 4 times
Joined: Jun 29, 2011 8:26 pm
Full Name: James
Contact:

How do you set Notification Email Address?

Post by jcwuerfl »

Assuming you need to use: Set-VBRJobOptions

If I do this I can see there is no Email Address set:

Code: Select all

$job=get-vbrjob -name theVMName
$jobOptions = Get-VBRJobOptions $job
$jobOptions.NotificationOptions
$jobOptions.NotificationOptions.EmailNotificationAddresses
So now how would you set it?


Also, how would you set the Retention Policy on # of Restore Points to Keep on disk?


Thanks
tsightler
VP, Product Management
Posts: 6009
Liked: 2843 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: How do you set Notification Email Address?

Post by tsightler »

I would do something like:

Code: Select all

$Job = Get-VBRJob -Name $JobName
$JobOptions = $Job.GetOptions()
$JobOptions.NotificationOptions.EmailNotification = $true
$JobOptions.NotificationOptions.EmailNotificationAddresses = "admin@backup.com"
$Job.SetOptions($Joboptions)
jcwuerfl
Enthusiast
Posts: 44
Liked: 4 times
Joined: Jun 29, 2011 8:26 pm
Full Name: James
Contact:

Re: How do you set Notification Email Address?

Post by jcwuerfl »

Great thank you.
Andreas Neufert
VP, Product Management
Posts: 6707
Liked: 1401 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: How do you set Notification Email Address?

Post by Andreas Neufert »

Hi everybody...
just a v8 update:

Code: Select all

Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue
$Job = Get-VBRJob -Name $JobName
$JobOptions = $Job.GetOptions()
$JobOptions.NotificationOptions.SnmpNotification  = $true #Default: $false
$JobOptions.NotificationOptions.SendEmailNotification2AdditionalAddresses  = $true #Default: $false
$JobOptions.NotificationOptions.EmailNotificationAdditionalAddresses = "test1@test.local;test2@test.local" #Default: ""
$JobOptions.NotificationOptions.UseCustomEmailNotificationOptions = $true #Default: $false
$JobOptions.NotificationOptions.EmailNotificationSubject = "[%JobResult%] %JobName% (%VmCount% VMs) %Issues%" #Default: "[%JobResult%] %JobName% (%VmCount% VMs) %Issues%"
$JobOptions.NotificationOptions.EmailNotifyOnSuccess = $false #Default: $true
$JobOptions.NotificationOptions.EmailNotifyOnWarning = $true #Default: $true
$JobOptions.NotificationOptions.EmailNotifyOnError = $true #Default: $true
$JobOptions.NotificationOptions.EmailNotifyOnLastRetryOnly  = $true #Default: $true
$JobOptions.ViSourceOptions.VmAttributeName = "TestField1"   #Default: "Notes"
$JobOptions.ViSourceOptions.SetResultsToVmNotes = $true #Default: $false
$JobOptions.ViSourceOptions.VmNotesAppend = $false #Default: $true
$Job.SetOptions($Joboptions)
$JobOptions.NotificationOptions
$JobOptions.ViSourceOptions
Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests