I've noticed if I create the Task for all my PC's on my DC through GPO Preferences with the "At startup" trigger (no matter what I execute, it can be VBS, EXE, PowerShell ...), Task will never execute.
So, this would be prerequisites:
Task should be created on the DC side with GPO Preferences (locally created Tasks work just fine, so please, don't bother checking this locally because it will work).
The problem is in "At startup" trigger ... all other triggers work just fine.
First I suspected something is wrong with the clients or DC or other GPO's or Windows Updates or ... So, I've setup two new VM's.
DC Server: Windows Server 2016, clean, no updates and only three GPO's (unmodified "Default Domain Policy", unmodified "Default Domain Controllers Policy" and my GPO that only creates one Task with the trigger "At startup")
Client: Windows 10 v1809, clean, no updates
It didn't help. I've then fully updated both DC Server and Client. It didn't help.
I have a workaround. Exactly the same Task with all the same options will execute during "Startup" just fine if it is created with two triggers:
At task creation/modification
Could someone confirm to me this is happening on their end also? Does someone have an explanation for this behavior?
Although I have a workaround for this, this is a problem. Why? Well what if we want Task to be executed only during startup and we want the task to be deleted once the computer is no longer part of Domain. Well, then it's a problem. If we want the Task to be deleted once the computer is no longer part of Domain, the Task must be created in "Replace" mode. But when the Task is in "Replace" mode, the Task is recreated every time the Client refreshes it's GPO (every so often), and we have our trigger configured to execute the Task "At task creation/modification", which means Task will not only execute during Startup but every time the computer refreshes it's GPO.
I would be grateful for any input you could give me or if you could at least confirm this is happening on your side also.
Thanks to the "Swisstone's" comment I've managed to figure out what is going on exactly. Also, maybe someone could have figured out solution instantly if I have fallowed one of the rules of this forum "be specific, be very specific and gather all the DATA".
If the task is created in "Replace"/"Update" mode, the Task is being recreated/updated all the time, and if you set the delay for the Task of 30 seconds, Task is being recreated/updated before it has time to trigger during startup.
You could of course always create the Task in "Create" mode but I don't ever create any GPO Preferences in that manner (you can not change it, you can not delete it once the Computer is no longer a part of Domain, so, not very useful method of creating any GPO Preference, at least not for me).
Thank you "Swisstone" one more time.