Get-sqmAgentJobScheduleReport
SQL Agent
sqmSQLTool v1.8.2+ · Get
msdb.dbo.sysjobs, sysjobschedules, sysschedules and sysjobhistory to show each job's schedule (frequency, start time, subday interval), last execution time, last status, average duration, estimated next run, and last error message (truncated to 100 chars). Writes the report as an HTML file and optionally as CSV. Returns a flat array of PSCustomObject — one row per job/schedule combination.
Parameters
| Parameter | Type | Required | Default | Notes |
|---|---|---|---|---|
| -SqlInstance | string | Optional | $env:COMPUTERNAME | Single instance. No pipeline support. |
| -SqlCredential | PSCredential | Optional | — | SQL auth. Omit for Windows auth. |
| -OutputPath | string | Optional | C:\System\WinSrvLog\MSSQL | Created if it does not exist. Write access is verified before running. |
| -OutputCsv | switch | Switch | $false | Also write a CSV alongside the HTML report. |
| -EnableException | switch | Switch | $false | Throw on error instead of Write-Error + return. |
Execution Flow
Examples
Basic report — local instance
Get-sqmAgentJobScheduleReport
Remote instance with CSV export
Get-sqmAgentJobScheduleReport -SqlInstance "SQL01" -OutputPath "D:\Reports" -OutputCsv
SQL auth, throw on error
$cred = Get-Credential Get-sqmAgentJobScheduleReport -SqlInstance "SQL01\PROD" -SqlCredential $cred -EnableException
Filter returned data for failed jobs only
Get-sqmAgentJobScheduleReport -SqlInstance "SQL01" |
Where-Object { $_.LastStatus -eq 'Failed' } |
Select-Object JobName, Schedule, LastExecution, LastError