Avatar of ddantes
ddantes
Flag for United States of America

asked on 

Windows Task Scheduler issues

Running Windows 7 Professional SP-1 64-bit.  I have a Windows Scheduled Task event with a custom trigger, to execute a batch file when Outlook opens, and after a one minute delay.  The Event Viewer does not seem to record any Application Event when Outlook is launched, so I  used a security audit event as a trigger.

The task is configured not to run another instance, if already running.  Most of the time, it works, but sometimes the batch file is executed without the delay.  And sometimes multiple instances of the batch file are launched.  Failing to implement the one minute delay is not critical, but I'd like to know if there is a way to avoid having more than one instance of the batch file running.  

I know that Windows 7 is no longer supported by Microsoft, and Office12 Outlook is a legacy application, and those factors are not an intended focus of this question.

Here is the custom trigger...

<QueryList>
  <Query Id="0" Path="Security">
    <Select Path="Security">
     *[System[Provider[@Name='Microsoft-Windows-Security-Auditing'] and Task = 13312 and (band(Keywords,9007199254740992)) and (EventID=4688)]] 
   and 
     *[EventData[Data[@Name='NewProcessName'] and (Data='C:\Program Files (x86)\Microsoft Office\office12\Outlook.exe')]]
    </Select>
  </Query>
</QueryList>

Open in new window

OutlookWindows OSWindows 7

Avatar of undefined
Last Comment
ddantes

8/22/2022 - Mon