Author | Tracy Boggiano (@TracyBoggiano), databasesuperhero.com |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Set-DbaAgentOperator on GitHub.
Want to see the Bill Of Health for this command? Check out Set-DbaAgentOperator.
Updates/modifies agent operators on an instance.
Updates/modifies agent operators on an instance.
Set-DbaAgentOperator
[[-SqlInstance] <DbaInstanceParameter[]>]
[[-SqlCredential] <PSCredential>]
[[-Operator] <String[]>]
[[-Name] <String>]
[[-EmailAddress] <String>]
[[-NetSendAddress] <String>]
[[-PagerAddress] <String>]
[[-PagerDay] <String>]
[[-SaturdayStartTime] <String>]
[[-SaturdayEndTime] <String>]
[[-SundayStartTime] <String>]
[[-SundayEndTime] <String>]
[[-WeekdayStartTime] <String>]
[[-WeekdayEndTime] <String>]
[-IsFailsafeOperator]
[[-FailsafeNotificationMethod] <String[]>]
[[-InputObject] <Operator[]>]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS:>Set-DbaAgentOperator -SqlInstance sql01 -Operator DBA -EmailAddress [email protected] -PagerDay Everyday
This sets the operator named DBA with the above email address with default values to alerts everyday for all hours of the day.
PS:>Set-DbaAgentOperator -SqlInstance sql01 -Operator DBA -EmailAddress [email protected] -NetSendAddress dbauser1 -PagerAddress [email protected] -PagerDay Everyday -SaturdayStartTime
070000 -SaturdayEndTime 180000 -SundayStartTime 080000 -SundayEndTime 170000 -WeekdayStartTime 060000 -WeekdayEndTime 190000
Creates a new operator named DBA on the sql01 instance with email address [email protected], net send address of dbauser1, pager address of [email protected], page day as every day,
Saturday start time of 7am, Saturday end time of 6pm, Sunday start time of 8am, Sunday end time of 5pm, Weekday start time of 6am, and Weekday end time of 7pm.
The target SQL Server instance or instances.
Alias | |
Required | False |
Pipeline | false |
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 |
Name of the operator in SQL Agent.
Alias | |
Required | False |
Pipeline | false |
Default Value |
The new name of the agent operator.
Alias | |
Required | False |
Pipeline | false |
Default Value |
The email address the SQL Agent will use to email alerts to the operator.
Alias | |
Required | False |
Pipeline | false |
Default Value |
The net send address the SQL Agent will use for the operator to net send alerts.
Alias | |
Required | False |
Pipeline | false |
Default Value |
The pager email address the SQL Agent will use to send alerts to the operator.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Defines what days the pager portion of the operator will be used. The default is 'Everyday'. Valid parameters
are 'EveryDay', 'Weekdays', 'Weekend', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', and
'Saturday'.
Alias | |
Required | False |
Pipeline | false |
Default Value | |
Accepted Values | EveryDay,Weekdays,Weekend,Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday |
This a string that takes the Saturday Pager Start Time.
Alias | |
Required | False |
Pipeline | false |
Default Value |
This a string that takes the Saturday Pager End Time.
Alias | |
Required | False |
Pipeline | false |
Default Value |
This a string that takes the Sunday Pager Start Time.
Alias | |
Required | False |
Pipeline | false |
Default Value |
This a string that takes the Sunday Pager End Time.
Alias | |
Required | False |
Pipeline | false |
Default Value |
This a string that takes the Weekdays Pager Start Time.
Alias | |
Required | False |
Pipeline | false |
Default Value |
This a string that takes the Weekdays Pager End Time.
Alias | |
Required | False |
Pipeline | false |
Default Value |
If this switch is enabled, this operator will be your failsafe operator and replace the one that existed before.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Defines the notification method(s) for the failsafe operator. The default is 'NotifyEmail'.
Valid parameter values are 'None', 'NotifyEmail', 'Pager', 'NetSend', 'NotifyAll'.
Values 'NotifyEmail', 'Pager', 'NetSend' can be specified in any combination.
Values 'None' and 'NotifyAll' cannot be specified in conjunction with any other value.
Alias | |
Required | False |
Pipeline | false |
Default Value | NotifyEmail |
Accepted Values | None,NotifyEmail,Pager,NetSend,NotifyAll |
SMO Server Objects (pipeline input from Connect-DbaInstance)
Alias | |
Required | False |
Pipeline | true (ByValue) |
Default Value |
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 |