Author | Sander Stad (@sqlstad), sqlstad.nl |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Remove-DbaAgentSchedule on GitHub.
Want to see the Bill Of Health for this command? Check out Remove-DbaAgentSchedule.
Removes job schedules.
Removes the schedules that have passed through the pipeline.
If not used with a pipeline, Get-DbaAgentSchedule will be executed with the parameters provided
and the returned schedules will be removed.
Remove-DbaAgentSchedule
[[-SqlInstance] <DbaInstanceParameter[]>]
[[-SqlCredential] <PSCredential>]
[[-Schedule] <String[]>]
[[-ScheduleUid] <String[]>]
[[-Id] <Int32[]>]
[[-InputObject] <ScheduleBase[]>]
[-EnableException]
[-Force]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> Remove-DbaAgentSchedule -SqlInstance sql1 -Schedule weekly
Remove the schedule weekly.
PS C:\> Remove-DbaAgentSchedule -SqlInstance sql1 -Schedule weekly -Force
Remove the schedule weekly even if the schedule is being used by jobs.
PS C:\> Remove-DbaAgentSchedule -SqlInstance sql1 -Schedule daily, weekly
Remove multiple schedules.
PS C:\> Remove-DbaAgentSchedule -SqlInstance sql1, sql2, sql3 -Schedule daily, weekly
Remove the schedule on multiple servers for multiple schedules.
PS C:\> Get-DbaAgentSchedule -SqlInstance sql1 -Schedule sched1, sched2, sched3 | Remove-DbaAgentSchedule
Remove the schedules using a pipeline.
PS C:\> Remove-DbaAgentSchedule -SqlInstance sql1, sql2, sql3 -ScheduleUid 'bf57fa7e-7720-4936-85a0-87d279db7eb7'
Remove the schedules using the schedule uid.
The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or greater.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.
Alias | |
Required | False |
Pipeline | false |
Default Value |
The name of the job schedule.
Please note that there can be several schedules with the same name. These differ then only in the Id or the ScheduleUid.
Alias | Schedules,Name |
Required | False |
Pipeline | false |
Default Value |
The unique identifier of the schedule.
Alias | Uid |
Required | False |
Pipeline | false |
Default Value |
The Id of the schedule.
Alias | |
Required | False |
Pipeline | false |
Default Value |
A collection of schedules (such as returned by Get-DbaAgentSchedule), to be removed.
Alias | |
Required | False |
Pipeline | true (ByValue) |
Default Value |
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Remove the schedules even if they where used in one or more jobs.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Shows what would happen if the command were to run. No actions are actually performed.
Alias | wi |
Required | False |
Pipeline | false |
Default Value |
Prompts you for confirmation before executing any changing operations within the command.
Alias | cf |
Required | False |
Pipeline | false |
Default Value |