Need help with this powershell script that will assign operator email for failure. Here is what I have:
$server = "SQLSERVER\NAMED_INSTANCE" [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | out-null; $srv = new-object Microsoft.SqlServer.Management.Smo.Server ($server) foreach ($job in $srv.JobServer.jobs) { $job.EmailLevel = [Microsoft.SqlServer.Management.Smo.Agent.CompletionAction]::OnFailure $job.OperatorToEmail = "SQLADMINS" }When I run it, it says script execution completed but after I checked nothing changed. Any idea?