title: "Install-DbaAgentAdminAlert" date: "2023-06-06" lastmod: 2025-11-01 draft: true categories:
- "sql-server"
- "powershell"
If you're wondering how to get reliable, actionable notifications when serious problems occur on your SQL Server, SQL Server Agent "admin" alerts are the long-standing, built-in answer. These alerts typically cover severity levels 16–25 and critical errors like 823, 824, and 825 so you hear about corruption, IO issues, and other high-impact events immediately.
The dbatools command named in this post, Install-DbaAgentAdminAlert, automates the tedious bits: creating the set of standard admin alerts and wiring them up to a SQL Agent operator. It’s idempotent, so you can run it repeatedly across servers and only missing pieces will be added.
What you need in place first:
- Database Mail configured and working on the instance
- A SQL Agent operator to receive notifications (use
New-DbaAgentOperatorif you don’t have one yet)
Quick start (safe preview):
1# See available parameters and examples
2Get-Help Install-DbaAgentAdminAlert -Detailed
3
4# Preview the changes without applying them
5Install-DbaAgentAdminAlert -SqlInstance 'sql01' -WhatIf
Roll out to multiple instances with a CSV or array and verify as you go:
1$servers = @('sql01','sql02','sql03')
2foreach ($s in $servers) {
3 Install-DbaAgentAdminAlert -SqlInstance $s -WhatIf
4}
Notes and tips:
- The command targets the classic “admin” set: severities 16–25 and common critical error numbers (e.g., 823/824/825). This aligns with Microsoft’s long‑recommended practice for SQL Agent alerts.
- Use
Get-Help Install-DbaAgentAdminAlert -Fullto see optional parameters for choosing or creating the operator and notification method. - After previewing with
-WhatIf, remove it to apply the configuration.
Further reading:
- SQL Server Agent alerts overview: https://learn.microsoft.com/sql/ssms/agent/alerts?view=sql-server-ver16
- dbatools home: https://dbatools.io/
Why this still matters in 2025: even with modern monitoring stacks, native SQL Agent alerts remain a lightweight, low‑latency safety net that travels with the instance and works in disconnected environments.