PowerShell script exchange
Post Reply
Stapper
Lurker
Posts: 1
Liked: never
Joined: May 06, 2015 4:04 pm
Full Name: Verstappen
Contact:

Remove singel email from notification

Post by Stapper » May 06, 2015 4:18 pm

I'm having a hard time finding the correct way to remove an email from the "notification" field via powershell.
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)
}
Can this be set to remove emailnotification addresses or is there no such thing?

Code: Select all

$JobOptions.NotificationOptions.EmailNotificationAddresses = "admin@backup.com" 

veremin
Product Manager
Posts: 17145
Liked: 1485 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Remove singel email from notification

Post by veremin » May 07, 2015 4:22 pm

Just to be sure there are several addresses specified in job notification settings as recipients, and you're willing to remove just one of those? Can you provide the current output of $JobOptions.NotificationOptions or $JobOptions.NotificationOptions.EmailNotificationAddresses? The actual addresses can be replaced of course.

Thanks.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests