Sample Header Ad - 728x90

Get-SqlAgentJobHistory Invoked By

1 vote
2 answers
262 views
I want to report on failed Sql Agent jobs using Get-SqlAgentJobHistory but excluded jobs that were not invoked by the service account. I'm running this cmd: Get-SqlAgentJobHistory -ServerInstance $SqlServer -OutcomesType Failed -StartRunDate ((Get-Date).AddMinutes(-15)) I want to exclude these: InstanceID : 146788 SqlMessageID : 0 Message : The job failed. The Job was ***invoked by User domain\user***. The last step to run was step 3 (packagename Pkg). StepID : 0 StepName : (Job outcome) but include these InstanceID : 146789 SqlMessageID : 0 Message : The job failed. The Job was ***invoked by User domain\serviceaccount***. The last step to run was step 3 (packagename Pkg). StepID : 0 StepName : (Job outcome)
Asked by Iain (11 rep)
Nov 3, 2018, 05:51 PM
Last activity: Jun 5, 2025, 07:06 PM