Last active
October 15, 2022 21:52
-
-
Save ghotz/f0f862e2d93a7b1d05bdc110a8a2a552 to your computer and use it in GitHub Desktop.
Change SQL Server Agent Alert Delay Between Responses from 0 to 60
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$cred = Get-Credential; | |
Get-DbaRegisteredServer -Group "Monitored\SQLAuth" | % { | |
Write-Host "connecting to $($_.ServerName)"; | |
$srv = new-object Microsoft.sqlserver.management.smo.server $_.ServerName; | |
$srv.ConnectionContext.LoginSecure = $false; | |
$srv.ConnectionContext.Login = $Cred.UserName; | |
$srv.ConnectionContext.set_SecurePassword($cred.Password); | |
$srv.JobServer.Alerts | % { | |
if ($_.DelayBetweenResponses -eq 0) { $_.DelayBetweenResponses = 60; $_.Alter(); } | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-DbaRegisteredServer -Group "Monitored\WindowsAuth" | % { | |
Write-Host "connecting to $($_.ServerName)"; | |
$srv = new-object Microsoft.sqlserver.management.smo.server $_.ServerName | |
; $srv.JobServer.Alerts | % { | |
if ($_.DelayBetweenResponses -eq 0) { $_.DelayBetweenResponses = 60; $_.Alter(); } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment