I’m trying to create a task that will run each time the current user logs in.
I’m having trouble finding any good examples or documentation. The best example I’ve found is this.
I tried swapping out TASK_TRIGGER_DAILY = 2 for TASK_TRIGGER_LOGON = 9, removing tigger.DaysInterval = 100 and using the associated objects like trigger.Delay, etc. found here.
It always results in:
Pywintyps.com error: (-2147352567, ‘Exception occurred.’, (0, None, None, None, 0 -2147024809), None) on line 67: result = rootFolder.RegisterTaskDefinition(task_id, taskDef, TASK_CREATE_OR_UPDATE, "", "", RUNFLAGSENUM[run_flags] )
#username, password
Calling schtasks.exe works, but that requires a UAC elevation request which I’d like to avoid.
A working example or some relevant Python documentation would be great. I’m not well versed enough in C++ to translate it all over to Python.