Run task scheduler task on demand from limited user account in windows 7
Go to C:\Windows\System32\Tasks find the related task and assign "read and execute" rights to the user you want to be able to access it. Be sure to assign to "current object only." Then the task will be visible and runnable from the limited user, and it will work if you saved your credentials in it and checked "run whether user is logged on or not."
Yep, that's terrible problem. Chosen answer no longer works. I'm using Event Log as a work around:
Register 'on an event' trigger for your task, e.g. "Application", "Application", 30204 (your magic number for this task)
Log an event with this id. To do that from commandline / batch, I've wrote dummy 3-line .Net console app.
using (var eventLog = new EventLog("Application"))
{
eventLog.Source = "Application";
eventLog.WriteEntry("EventLogTriggeer", EventLogEntryType.Information, int.Parse(args[0]));
}
In my case I've solved security for automated deployments on staging environment. GitHub makes POST request to my node.js backend that runs under IIS AppPool Identity with r/o access to the folder. It verifies hash-signature, and executes:
// delegate to priviledged task
exec('%SystemDrive%\\apps\\EventLogTrigger 30204', (err, stdout, stderr)=> /* ... */);
The remaining part is done via scheduled task that runs deployment script under the user that have permissions to modify files in inetpub. Tasks are individually configured for each server and each website on them, so, the path is hardcoded:
C:\inetpub\ta\autodeploy.cmd