New‑SqlDscAgentOperator - dsccommunity/SqlServerDsc GitHub Wiki

SYNOPSIS

Creates a new SQL Agent Operator.

SYNTAX

New-SqlDscAgentOperator [-ServerObject] <Server> [-Name] <String> [[-EmailAddress] <String>]
 [[-CategoryName] <String>] [[-NetSendAddress] <String>] [[-PagerAddress] <String>] [[-PagerDays] <WeekDays>]
 [[-SaturdayPagerEndTime] <TimeSpan>] [[-SaturdayPagerStartTime] <TimeSpan>] [[-SundayPagerEndTime] <TimeSpan>]
 [[-SundayPagerStartTime] <TimeSpan>] [[-WeekdayPagerEndTime] <TimeSpan>] [[-WeekdayPagerStartTime] <TimeSpan>]
 [-PassThru] [-Force] [-Refresh] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

This command creates a new SQL Agent Operator on a SQL Server Database Engine instance.

EXAMPLES

EXAMPLE 1

$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
New-SqlDscAgentOperator -ServerObject $serverObject -Name 'MyOperator' -EmailAddress '[email protected]'

Creates a new SQL Agent Operator named 'MyOperator' with an email address.

EXAMPLE 2

$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$serverObject | New-SqlDscAgentOperator -Name 'MyOperator' -EmailAddress '[email protected]'

Creates a new SQL Agent Operator named 'MyOperator' with an email address using pipeline input.

EXAMPLE 3

$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$operatorObject = $serverObject | New-SqlDscAgentOperator -Name 'MyOperator' -EmailAddress '[email protected]' -PassThru

Creates a new SQL Agent Operator with an email address and returns the created object.

EXAMPLE 4

$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$serverObject | New-SqlDscAgentOperator -Name 'MyOperator' -EmailAddress '[email protected]' -Refresh

Creates a new SQL Agent Operator, refreshing the operators collection before checking if it already exists.

PARAMETERS

-CategoryName

Specifies the category name for the SQL Agent Operator.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-EmailAddress

Specifies the email address for the SQL Agent Operator.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Force

Specifies that the operator should be created without any confirmation.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Name

Specifies the name of the SQL Agent Operator to create.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-NetSendAddress

Specifies the net send address for the SQL Agent Operator.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-PagerAddress

Specifies the pager address for the SQL Agent Operator.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-PagerDays

Specifies the days when pager notifications are active for the SQL Agent Operator.

Type: WeekDays
Parameter Sets: (All)
Aliases:
Accepted values: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, WeekDays, Saturday, WeekEnds, EveryDay

Required: False
Position: 7
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-PassThru

If specified, the created operator object will be returned.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Refresh

Specifies that the ServerObject's operators should be refreshed before testing if the operator already exists. This is helpful when operators could have been modified outside of the ServerObject, for example through T-SQL. But on instances with a large amount of operators it might be better to make sure the ServerObject is recent enough.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-SaturdayPagerEndTime

Specifies the Saturday pager end time for the SQL Agent Operator.

Type: TimeSpan
Parameter Sets: (All)
Aliases:

Required: False
Position: 8
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-SaturdayPagerStartTime

Specifies the Saturday pager start time for the SQL Agent Operator.

Type: TimeSpan
Parameter Sets: (All)
Aliases:

Required: False
Position: 9
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ServerObject

Specifies current server connection object.

Type: Server
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-SundayPagerEndTime

Specifies the Sunday pager end time for the SQL Agent Operator.

Type: TimeSpan
Parameter Sets: (All)
Aliases:

Required: False
Position: 10
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-SundayPagerStartTime

Specifies the Sunday pager start time for the SQL Agent Operator.

Type: TimeSpan
Parameter Sets: (All)
Aliases:

Required: False
Position: 11
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WeekdayPagerEndTime

Specifies the weekday pager end time for the SQL Agent Operator.

Type: TimeSpan
Parameter Sets: (All)
Aliases:

Required: False
Position: 12
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WeekdayPagerStartTime

Specifies the weekday pager start time for the SQL Agent Operator.

Type: TimeSpan
Parameter Sets: (All)
Aliases:

Required: False
Position: 13
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

Microsoft.SqlServer.Management.Smo.Server

SQL Server Database Engine instance object.

OUTPUTS

[Microsoft.SqlServer.Management.Smo.Agent.Operator] if passing parameter PassThru,

otherwise none.

NOTES

RELATED LINKS

⚠️ **GitHub.com Fallback** ⚠️