Set‑SqlDscAgentAlert - dsccommunity/SqlServerDsc GitHub Wiki
Updates a SQL Agent Alert.
Set-SqlDscAgentAlert -ServerObject <Server> -Name <String> [-Severity <Int32>] [-MessageId <Int32>] [-PassThru]
[-Refresh] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]
Set-SqlDscAgentAlert -AlertObject <Alert> [-Severity <Int32>] [-MessageId <Int32>] [-PassThru] [-Force]
[-WhatIf] [-Confirm] [<CommonParameters>]
This command updates an existing SQL Agent Alert on a SQL Server Database Engine instance.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
Set-SqlDscAgentAlert -ServerObject $serverObject -Name 'MyAlert' -Severity 16
Updates the SQL Agent Alert named 'MyAlert' to severity level 16.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$alertObject = $serverObject | Get-SqlDscAgentAlert -Name 'MyAlert'
$alertObject | Set-SqlDscAgentAlert -MessageId 50001
Updates the SQL Agent Alert using pipeline input with alert object.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$updatedAlert = $serverObject | Set-SqlDscAgentAlert -Name 'MyAlert' -Severity 16 -PassThru
Updates the alert and returns the updated object.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
Set-SqlDscAgentAlert -ServerObject $serverObject -Name 'MyAlert' -Severity 16 -Force
Updates the SQL Agent Alert named 'MyAlert' to severity level 16 without prompting for confirmation.
Specifies an alert object to update.
Type: Alert
Parameter Sets: AlertObject
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Specifies that the alert should be updated 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: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
Specifies the name of the SQL Agent Alert to update.
Type: String
Parameter Sets: ServerObject
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
If specified, the updated 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 that the alert object should be refreshed before updating. This is helpful when alerts could have been modified outside of the ServerObject, for example through T-SQL.
Type: SwitchParameter
Parameter Sets: ServerObject
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: ServerObject
Aliases:
Required: True
Position: Named
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: Named
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.