PowerShell script exchange
Post Reply
zacthompson
Novice
Posts: 3
Liked: never
Joined: May 03, 2023 7:11 pm
Full Name: Zac Thompson
Contact:

Mass change of notification settings.

Post by zacthompson »

I'm in a situation where I need to set all backup jobs to use the global notification settings. All are set to use a custom at the moment. Is there a quick way to do this with Powershell? I tried researching but wasn't able to find what I was looking for.
david.domask
Veeam Software
Posts: 1226
Liked: 323 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Mass change of notification settings.

Post by david.domask »

Hi @zacthompson, sure, this is a pretty fast one. There is a "slight" hiccup in that if you have a mix of Image Level (VMs) and Agent Based Backups, you might need to do some filtering.

You can try something like this:

$jobs = Get-VBRJob
foreach($j in $jobs){
$jOpts = Get-VBRJobOptions -Job $j
$jOpts.NotificationOptions.UseCustomEmailNotificationOptions = $False
Set-VBRJobOptions -Job $j -Options $jOpts
}

This will just disable the custom email notifications and use the global notifications instead.

Note that this will throw an error on Backup Copies as they have a different cmdlet. If you have a ton of backup copies that also need to be changed, let me know as fleshing this out with proper handling isn't too hard, but just don't want to chase this if we don't need to :)
David Domask | Product Management: Principal Analyst
zacthompson
Novice
Posts: 3
Liked: never
Joined: May 03, 2023 7:11 pm
Full Name: Zac Thompson
Contact:

Re: Mass change of notification settings.

Post by zacthompson »

Thanks David! That did exactly what I needed. Can I use that same script and edit it to change the recipient email address for the backup jobs?
david.domask
Veeam Software
Posts: 1226
Liked: 323 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Mass change of notification settings.

Post by david.domask »

Hi @zacthompson,

Very glad to hear it worked.

And yes, you can use the same script to mass-edit the email settings.

Use Get-VBRJob to save any job to the $job variable as at test, and pass that job to Get-VBRJobOptions on the -Job Paramater.

Check the object property of the Get-VBRJobOptions object (pipe the data to Get-Member, or gm for short). you can check the same properties I used above and find where to set the emails, and then you can just reverse the script to re-enable it.
David Domask | Product Management: Principal Analyst
Post Reply

Who is online

Users browsing this forum: Amazon [Bot] and 11 guests