Test‑SqlDscAgentAlertProperty - dsccommunity/SqlServerDsc GitHub Wiki
Tests if a SQL Agent Alert has the specified properties.
Test-SqlDscAgentAlertProperty -ServerObject <Server> -Name <String> [-Severity <Int32>] [-MessageId <Int32>]
[<CommonParameters>]
Test-SqlDscAgentAlertProperty -AlertObject <Alert> [-Severity <Int32>] [-MessageId <Int32>]
[<CommonParameters>]
This command tests if a SQL Agent Alert on a SQL Server Database Engine instance has the specified properties. At least one property parameter must be specified.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
Test-SqlDscAgentAlertProperty -ServerObject $serverObject -Name 'MyAlert' -Severity 16
Tests if the SQL Agent Alert named 'MyAlert' exists and has severity level 16.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$serverObject | Test-SqlDscAgentAlertProperty -Name 'MyAlert' -MessageId 50001
Tests if the SQL Agent Alert named 'MyAlert' exists and has message ID 50001.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$alertObject = $serverObject | Get-SqlDscAgentAlert -Name 'MyAlert'
$alertObject | Test-SqlDscAgentAlertProperty -Severity 16
Tests if the SQL Agent Alert has severity level 16 using alert object pipeline input.
Specifies the SQL Agent Alert object to test.
Type: Alert
Parameter Sets: ByAlertObject
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Specifies the expected message ID for the SQL Agent Alert. Valid range is 0 to 2147483647. If specified, the command will return $true only if the alert exists and has this message ID.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
Specifies the name of the SQL Agent Alert to test.
Type: String
Parameter Sets: ByServerAndName
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies current server connection object.
Type: Server
Parameter Sets: ByServerAndName
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Specifies the expected severity level for the SQL Agent Alert. Valid range is 0 to 25. If specified, the command will return $true only if the alert exists and has this severity.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.