0
On a Windows Server 2016 machine, I want to configure Task Scheduler to run an action based on an event. But I cannot get it to work.
Here is how I can easily reproduce it:
- If not done yet, click on Enable All Tasks History at the Actions pane on the right
- Click on Create Task...
- Enter "Trigger Test" in the Name field
- Go to the Triggers tab, click New
- For Begin the task:, select On an event; as Log select System; click OK
- Go to the Actions tab, click New
- In Program/script, enter "C:\Windows\notepad.exe"; click OK
- Click OK to finally create the task
Now go to the History tab of the "Trigger Test" task. Besides the Information, that the "Trigger Test" task is registered, there is a warning with Event ID 113, saying:
Task registered task "\Trigger Test" , but not all specified triggers will start the task. User Action: Ensure all the task triggers are valid as configured. Additional Data: Error Value: 2147946601.
The history entries may only be available a few seconds after the task is created, press F5 to refresh in that case.
So I cannot get my task to work. Of course, I want to register for specific events and instead of "notepad.exe", I want to run a PowerShell script to send an e-mail. But the same problem occurs there, and above is the easiest way I could break it down to not working.
All other values of the task remain default values, so the task will run under the current user and only if he is logged on.
I don't know if it matters, but it is a Windows Server 2016 Datacenter edition (version 1607) running on Amazon AWS in an EC2 instance.
Any help would be appreciated, as I already spent hours and hours of research and trial & error, but without any success. Googling the above error message - especially together with that exact error code - doesn't reveal anything useful.
@Hi, I'm unclear on the triggers and actions? In the end you want to run a powershell script to send you an email, triggered by some event? On your example using "notepad.exe" as an event trigger, did you registered the task as
admin
? The thing is in my machine it states the app as owned by the admin – dmb – 2018-12-18T18:15:05.197Yes, in the end I want to run a PS script instead of notepad.exe. But I still want an event as a trigger, but this does not work. I tried creating the task with different users (current user who is local admin, LOCAL SERVICE, NETWORK SERICE, SYSTEM), with and without elevation, but none of that worked. What do you mean by "app"? – Tobias – 2018-12-19T06:58:52.670
Ok, that’s why I asked. Triggers are the conditions to be met in order for your psScript to run. So in this case you can trigger the event by schudle, or by some event. Like user login, logout, etc. I think you got them mixed up. Have you tried running it on a set date? – dmb – 2018-12-19T11:34:24.983
What do you think I got mixed up? Yes, I tried it with a fixed schedule, just for testing, and that worked. Only when I set the trigger to an event, it does not work and gives the error message. – Tobias – 2018-12-19T12:32:55.127
I'm suddenly having a similar problem with a scheduled task set to trigger daily and repeat every 15 minutes for 16 hours. The task used to repeat just fine, but now it starts once at the scheduled time and that's it. – drzaus – 2019-07-11T19:26:57.850