Windows Events have an ability to filter by XPATH (which is a fast search). I have sucessfully using the PowerSHell Cmdlet Get-WinEvent filtered where a specific value is a specific value as shown below
$qry = "*[(EventData/Data[@Name='TaskName'] ='\Microsoft\Windows\Diagnosis\Scheduled') ]"
Get-WinEvent -LogName Microsoft-Windows-TaskScheduler/Operational -FilterXPath $qry -ErrorAction SilentlyContinue -MaxEvents 3
However i don't really want to filter by a specfic task name but a substring of it, a start-with of contains or something.. for instance in the above scenario i want to do "startswith" \Microsoft\Windows\Diagnosis . However all the different techniques i've tried, that seem like standard XPATH 1.0 syntax such as
$qry = "*[starts-with(EventData/Data[@Name='TaskName'] ,'\Microsoft\Windows\Diagnosis') ]"
give an error Get-WinEvent : The specified query is invalid