List failed SQL server Jobs with Powershell
Posted by: SQL Server DBA,
on 06 Feb 2012 |
View original | Bookmarked: 0 time(s)
This post explains how to list failed SQL Server Jobs , on multiple SQL Server Instances and output the results to a HTML file.
It is only one extra step to send this file as an attachment.
The example script , returns failed SQL Server Agent Jobs within the last 48 hrs, for a SQL Server Instance.
$isodate=Get-Date -format s
$isodate=$isodate -replace(":","")
$basepath=(Get-Location -PSProvider FileSystem).ProviderPath
$instancepath=$basepath + "\instances.txt"
$outputfile="\logs\sql_server_health_sqlserver_jobs_"...