Assert‑SqlDscAgentOperator - dsccommunity/SqlServerDsc GitHub Wiki

SYNOPSIS

Asserts that a SQL Server Agent Operator exists and throws a terminating error if not found.

SYNTAX

Assert-SqlDscAgentOperator [-ServerObject] <Server> [-Name] <String> 
 [<CommonParameters>]

DESCRIPTION

This command asserts that a SQL Server Agent Operator exists using the provided parameters. If the operator is not found, it throws a terminating error with a generic localized error message.

EXAMPLES

EXAMPLE 1

$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$serverObject | Assert-SqlDscAgentOperator -Name 'TestOperator'

Asserts that the SQL Agent Operator 'TestOperator' exists, throws error if not found.

EXAMPLE 2

Assert-SqlDscAgentOperator -ServerObject $serverObject -Name 'TestOperator'

Asserts that the SQL Agent Operator 'TestOperator' exists, throws error if not found.

PARAMETERS

-Name

Specifies the name of the operator to check for.

Type: String
Parameter Sets: (All)
Aliases:

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

-ServerObject

Specifies the server object on which to check for the operator.

Type: Server
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
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]

OUTPUTS

None.

This command does not return anything if the operator exists.

NOTES

RELATED LINKS

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