dbatools is a free PowerShell module with over 300 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


Remove-DbaAgentJob

Remove-DbaAgentJob removes a job in the SQL Server Agent.

Screenshots

dbatools - Remove-DbaAgentJob

Examples

Remove-DbaAgentJob -SqlInstance sql1 -Job Job1

Removes the job from the instance with the name Job1

Remove-DbaAgentJob -SqlInstance sql1 -Job Job1 -KeepHistory

Removes the job but keeps the history

Remove-DbaAgentJob -SqlInstance sql1 -Job Job1 -KeepUnusedSchedule

Removes the job but keeps the unused schedules

Remove-DbaAgentJob -SqlInstance sql1, sql2, sql3 -Job Job1

Removes the job from multiple servers

sql1, sql2, sql3 | Remove-DbaAgentJob -Job Job1

Removes the job from multiple servers using pipe line

Author

This command was created by Sander Stad. You can find Sander on [LinkedIn] and blogging at [sqlstad.nl]

Get-Help

From PowerShell, execute Get-Help Remove-DbaAgentJob -Detailed for more information on this function.

Source Code

Want to see the source code? View Remove-DbaAgentJob.ps1 on GitHub
 

Related commands