New‑SqlDscAgentAlert - dsccommunity/SqlServerDsc GitHub Wiki
Creates a new SQL Agent Alert.
New-SqlDscAgentAlert [-ServerObject] <Server> [-Name] <String> [[-Severity] <Int32>] [[-MessageId] <Int32>]
[-PassThru] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]
This command creates a new SQL Agent Alert on a SQL Server Database Engine instance.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
New-SqlDscAgentAlert -ServerObject $serverObject -Name 'MyAlert' -Severity 16
Creates a new SQL Agent Alert named 'MyAlert' with severity level 16.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$serverObject | New-SqlDscAgentAlert -Name 'MyAlert' -MessageId 50001
Creates a new SQL Agent Alert named 'MyAlert' for message ID 50001 using pipeline input.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$alertObject = $serverObject | New-SqlDscAgentAlert -Name 'MyAlert' -Severity 16 -PassThru
Creates a new SQL Agent Alert and returns the created object.
Forces the action without prompting for confirmation.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Specifies the message ID for the SQL Agent Alert. Valid range is 0 to 2147483647. Cannot be used together with Severity.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
Specifies the name of the SQL Agent Alert to create.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
If specified, the created alert 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
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
Specifies the severity level for the SQL Agent Alert. Valid range is 0 to 25. Cannot be used together with MessageId.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
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
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
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Either -Severity or -MessageId must be specified (mutually exclusive).