Stephen Bennett, sqlnotesfromtheunderground.wordpress.com
Get-DbaRunningJob View Source Stephen Bennett, sqlnotesfromtheunderground.wordpress.com Windows, Linux, macOS Synopsis Retrieves SQL Server Agent jobs that are currently executing
Description This function returns SQL Server Agent jobs that are actively running at the moment you call it, filtering out any jobs in idle state.
Use this to monitor job execution during maintenance windows, troubleshoot performance issues by identifying resource-consuming jobs, or verify that no jobs are running before performing maintenance operations.
New-DbaAgentJob View Source Sander Stad (@sqlstad), sqlstad.nl Windows, Linux, macOS Synopsis Creates SQL Server Agent jobs with notification settings and schedule assignments
Description Creates SQL Server Agent jobs with full configuration options including owner assignment, job categories, and comprehensive notification settings.
You can configure email, event log, pager, and netsend notifications with specific operators and trigger conditions (success, failure, completion).
The function also supports attaching existing schedules during job creation and can automatically create missing job categories when using -Force.
New-DbaAgentJobCategory View Source Sander Stad (@sqlstad), sqlstad.nl Windows, Linux, macOS Synopsis Creates new SQL Server Agent job categories for organizing and managing jobs.
Description Creates custom job categories in SQL Server Agent to help organize and classify jobs by function, department, or priority level. Job categories provide a way to group related jobs together for easier management and reporting, replacing the need to manually create categories through SQL Server Management Studio.
New-DbaAgentJobStep View Source Sander Stad (@sqlstad), sqlstad.nl Windows, Linux, macOS Synopsis Creates a new step within an existing SQL Server Agent job with configurable execution options and flow control
Description Creates individual job steps within SQL Server Agent jobs, allowing you to build complex automation workflows without manually configuring each step through SSMS. Each step can execute different types of commands (T-SQL, PowerShell, SSIS packages, OS commands) and includes retry logic, success/failure branching, and output capture.
New-DbaAgentSchedule View Source Sander Stad (@sqlstad), sqlstad.nl Windows, Linux, macOS Synopsis Creates a new SQL Server Agent schedule for automated job execution
Description Creates a new schedule in the msdb database that defines when SQL Server Agent jobs should execute. Schedules can be created as standalone objects or immediately attached to existing jobs, allowing you to standardize timing across multiple jobs without recreating the same schedule repeatedly. This replaces the need to manually create schedules through SQL Server Management Studio or T-SQL, while providing comprehensive validation of schedule parameters and frequency options.
Remove-DbaAgentJob View Source Sander Stad (@sqlstad, sqlstad.nl) Windows, Linux, macOS Synopsis Removes SQL Server Agent jobs from one or more instances with options to preserve history and schedules.
Description Removes SQL Server Agent jobs from the target instances using the sp_delete_job system stored procedure. By default, both job history and unused schedules are deleted along with the job itself. You can optionally preserve job execution history for compliance or troubleshooting purposes, and keep unused schedules that might be reused for other jobs.
Remove-DbaAgentJobCategory View Source Sander Stad (@sqlstad, sqlstad.nl) Windows, Linux, macOS Synopsis Removes SQL Server Agent job categories from one or more instances.
Description Removes custom SQL Server Agent job categories that are no longer needed for job organization and management.
This is useful when cleaning up obsolete categories after reorganizing jobs or migrating workloads between environments.
Any jobs currently assigned to a removed category will automatically be reassigned to the default “[Uncategorized (Local)]” category.
Remove-DbaAgentJobStep View Source Sander Stad (@sqlstad), sqlstad.nl Windows, Linux, macOS Synopsis Removes specified job steps from SQL Server Agent jobs.
Description Removes individual job steps from SQL Server Agent jobs by step name. This function validates that both the job and step exist before attempting removal, preventing errors when cleaning up outdated or broken job steps. Useful for job maintenance tasks like removing obsolete backup steps, failed notification steps, or deprecated processes without affecting the rest of the job workflow.
Remove-DbaAgentSchedule View Source Sander Stad (@sqlstad), sqlstad.nl Windows, Linux, macOS Synopsis Removes SQL Server Agent schedules from one or more instances.
Description Removes SQL Server Agent schedules from the msdb database, handling both unused schedules and those currently assigned to jobs. The function first removes schedule associations from any jobs using the schedule, then drops the schedule itself to prevent orphaned references. Use this when cleaning up unused schedules during maintenance, consolidating multiple schedules, or removing schedules as part of job reorganization.
Set-DbaAgentJob View Source Sander Stad (@sqlstad), sqlstad.nl Windows, Linux, macOS Synopsis Modifies existing SQL Server Agent job properties and notification settings.
Description Updates various properties of SQL Server Agent jobs including job name, description, owner, enabled/disabled status, notification settings, and schedule assignments. This function lets you modify jobs without using SQL Server Management Studio, making it useful for standardizing job configurations across multiple instances or automating job maintenance tasks. You can update individual jobs or perform bulk changes across multiple jobs and SQL Server instances simultaneously.