Test‑SqlDscIsAgentOperator - dsccommunity/SqlServerDsc GitHub Wiki

SYNOPSIS

Tests for the existence of a SQL Agent Operator.

SYNTAX

Test-SqlDscIsAgentOperator [-ServerObject] <Server> [-Name] <String> [-Refresh]
 [<CommonParameters>]

DESCRIPTION

This command tests if a SQL Agent Operator exists on a SQL Server Database Engine instance.

EXAMPLES

EXAMPLE 1

$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
Test-SqlDscIsAgentOperator -ServerObject $serverObject -Name 'MyOperator'

Tests if the SQL Agent Operator named 'MyOperator' exists.

EXAMPLE 2

$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$serverObject | Test-SqlDscIsAgentOperator -Name 'MyOperator'

Tests if the SQL Agent Operator named 'MyOperator' exists using pipeline input.

EXAMPLE 3

$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$serverObject | Test-SqlDscIsAgentOperator -Name 'MyOperator' -Refresh

Refreshes the server operators collection before testing if MyOperator exists.

PARAMETERS

-Name

Specifies the name of the SQL Agent Operator to test.

Type: String
Parameter Sets: (All)
Aliases:

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

-Refresh

Specifies that the ServerObject's operators should be refreshed before testing the operator. 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

-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

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

System.Boolean

Returns $true if the operator exists, $false otherwise.

NOTES

RELATED LINKS

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