Author | Chrissy LeMaire (@cl), netnerds.net |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Install-DbaAgentAdminAlert on GitHub.
Want to see the Bill Of Health for this command? Check out Install-DbaAgentAdminAlert.
Creates SQL Server Agent alerts commonly needed by DBAs
Creates SQL Server Agent alerts commonly needed by DBAs
You can specify an operator to use for the alert, or it will use any operator it finds if there is just one.
Alternatively, if you specify both an operator name and an email, it will create the operator if it does not exist.
Install-DbaAgentAdminAlert
[-SqlInstance] <DbaInstanceParameter[]>
[[-SqlCredential] <PSCredential>]
[[-Category] <String>]
[[-Database] <String>]
[[-Operator] <String>]
[[-OperatorEmail] <String>]
[[-DelayBetweenResponses] <Int32>]
[-Disabled]
[[-EventDescriptionKeyword] <String>]
[[-EventSource] <String>]
[[-JobId] <String>]
[[-ExcludeSeverity] <Int32[]>]
[[-ExcludeMessageId] <Int32[]>]
[[-NotificationMessage] <String>]
[[-NotifyMethod] <String>]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> Install-DbaAgentAdminAlert -SqlInstance sql1
Creates alerts for severity 17-25 and messages 823-825 on sql1
The target SQL Server instance or instances
Alias | |
Required | True |
Pipeline | true (ByValue) |
Default Value |
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.
Alias | |
Required | False |
Pipeline | false |
Default Value |
The name of the category for the alert. If not specified, the alert will be created in the 'Uncategorized' category.
If the category does not exist, it will be created.
Alias | |
Required | False |
Pipeline | false |
Default Value |
The name of the database to which the alert applies
Alias | |
Required | False |
Pipeline | false |
Default Value |
The name of the operator to use in the alert
Alias | |
Required | False |
Pipeline | false |
Default Value |
If a the specified operator does not exist and an OperatorEmail is specified, the operator will be created
Alias | |
Required | False |
Pipeline | false |
Default Value |
The delay (in seconds) between responses to the alert
Alias | |
Required | False |
Pipeline | false |
Default Value | 0 |
Whether the alert is disabled
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
The keyword to search for in the event description
Alias | |
Required | False |
Pipeline | false |
Default Value |
The source of the event
Alias | |
Required | False |
Pipeline | false |
Default Value |
The GUID ID of the job to execute when the alert is triggered
Alias | |
Required | False |
Pipeline | false |
Default Value | 00000000-0000-0000-0000-000000000000 |
Exclude specific severities from the batch. By default, severities 17-25 are included.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Exclude specific message IDs from the batch. By default, mesasage IDs 823-825 are included.
Alias | |
Required | False |
Pipeline | false |
Default Value |
The message to send when the alert is triggered
Alias | |
Required | False |
Pipeline | false |
Default Value |
The method to use to notify the user of the alert. Valid values are 'None', 'NotifyEmail', 'Pager', 'NetSend', 'NotifyAll'. It is NotifyAll by default.
Alias | |
Required | False |
Pipeline | false |
Default Value | NotifyAll |
Accepted Values | None,NotifyEmail,Pager,NetSend,NotifyAll |
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Shows what would happen if the command were to run. No actions are actually performed.
Alias | wi |
Required | False |
Pipeline | false |
Default Value |
Prompts you for confirmation before executing any changing operations within the command.
Alias | cf |
Required | False |
Pipeline | false |
Default Value |