I have to remove 1 of several email notifications from all jobs. Can this be done using powershell or do I need to remove them manully?
Do I just need to rewrite all the email adresses I do want or can I just say remove that one?
Will following code work or not? I don't have a testing environement so i need to know, if this will only affect the email notification job setting or also other settings?
Code: Select all
$jobs = Get-VBRJob
foreach ($job in $jobs)
{
$JobOptions = $Job.GetOptions()
$JobOptions.NotificationOptions.EmailNotification = $true
$JobOptions.NotificationOptions.EmailNotificationAddresses = "admin@backup.com"
$Job.SetOptions($Joboptions)
}
Code: Select all
$JobOptions.NotificationOptions.EmailNotificationAddresses = "admin@backup.com"