Get-SqlAgentJobHistory Invoked By 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)
Try filtering returned objects based on the message text.

Get-SqlAgentJobHistory -ServerInstance $SqlServer -OutcomesType Failed -StartRunDate ((Get-Date).AddMinutes(-15)) | Where-Object {$_.message -Like "*invoked by User domain\serviceaccount*"}