📊Automate SQL Agent Job Status and Performance Report with a Plug-and-Play PowerShell Report

Managing SQL Server Agent jobs across a growing environment can quickly become overwhelming. With dozens (or even hundreds) of jobs running on multiple servers, it’s easy to miss failures, delays, or misconfigurations that can impact business processes and data integrity.

To solve this, we’ve developed a plug-and-play PowerShell script that automates the collection, reporting, and email delivery of SQL Server Agent job status and performance across your environment—all presented in a color-coded HTML dashboard.

Report As like below:


SQL Agent Job  Status and Performance Report with a Plug-and-Play PowerShell Report

Why You Need This Report

  • Centralized Visibility – See all jobs across all your servers in one place.

  • Early Failure Detection – Instantly spot job failures, delays, or disabled schedules.

  • Tracks New Jobs – Highlights jobs created in the past 24 hours.

  • Automated Delivery – Automatically runs daily and sends the report via email.

  • Lightweight & Plug-and-Play – Just provide a server list; no extra setup needed.

  • HTML Report – Color-coded and browser-friendly for easy scanning and sharing.

What the Report Shows

The HTML report contains two sections:

1. New Job Creation Report

Displays jobs that were created in the last 24 hours, useful for tracking new deployments and change auditing.

2. SQL Agent Job Status Report

Highlights jobs that ran today, filtering those that ran over 10 minutes and excluding irrelevant categories (like Rebuild, Backup, or Fragmentation jobs).

Each job is color-coded based on its last run duration:

  • 🟩 Green (good) – Duration ≤ 10 minutes

  • 🟨 Yellow (warning) – Duration > 10 and ≤ 15 minutes

  • 🟥 Red (critical) – Duration > 15 minutes

How It Works

1. Prepare a Server List

Create a simple text file listing your SQL Server instances:

plaintext
servers.txt ------------ SQLDBAHUB\SQLDBAHUB SQLDBAHUB2\SQLDBAHUB2 SQLDBAHUB4-NEW\SQLDBAHUB4 ...

2. Run the Script

Execute the PowerShell script, providing the server list as input. The script will:

  • Connect to each server

  • Run two queries:

    • One for newly created jobs

    • One for jobs that ran today and exceeded 10 minutes

  • Generate an HTML report

  • Email the report automatically

3. Receive Your Report

The report is emailed as an attachment to the DBA team daily, making it part of your regular health checks.

Example Use Cases

  • Morning DBA checklist

  • Backup and maintenance monitoring

  • Deployment validation

  • SLA and compliance reporting

  • Incident triage (identify job failures quickly)

💡 Summary

This PowerShell-powered SQL Server Agent Job Report helps automate what would otherwise be a time-consuming, manual process. It provides DBAs with a daily, visual snapshot of the SQL job landscape—highlighting what’s healthy, what’s risky, and what’s new.

By simply maintaining a list of SQL servers, you can plug this into your daily monitoring routine and get peace of mind delivered to your inbox—without logging into SSMS.

No comments:

Post a Comment

Popular Posts