Link to home
Start Free TrialLog in
Avatar of ddantes
ddantesFlag 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

Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

to execute a batch file when Outlook opens, and after a one minute delay.

Depends upon your batch file.. are you using the start /wait parameter?

https://ss64.com/nt/start.html
Avatar of ddantes

ASKER

The batch file, itself, has a timeout before it performs its job.  I was referring to the launch of that batch file, which Task Scheduler is supposed to delay for one minute after the trigger, and sometimes it does not.  My main concern is the launching of multiple instances of the batch file, despite configuring that not to happen.
ASKER CERTIFIED SOLUTION
Avatar of ddantes
ddantes
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial