Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Creating Windows Scheduled Tasks From a Program That Wake The Computer To Run the Task

69 views
Skip to first unread message

sengsational

unread,
Feb 27, 2008, 4:09:52 PM2/27/08
to
If you have wondered where to start looking when you would like to
programatically create a Windows scheduled task that will allow for
the system to resume from an S3 state or S4 state in order to run your
task, this post might help. It doesn't tell you how to code it, but
with what you find here and your favorite search tool, you should get
a good start.

It seems the windows AT command and the windows SCHTASKS command do
not allow for the management of the attribute that will allow the
machine to resume from a sleep state.

Instead, you would use the SetFlags method on
TASK_FLAG_SYSTEM_REQUIRED in the IScheduledWorkItem interface.
TASK_FLAG_SYSTEM_REQUIRED is 0x1000 or 4096 decimal.

SetFlags Method of the IScheduledWorkItem Interface:

TASK_FLAG_SYSTEM_REQUIRED

The work item causes the system to be resumed, or awakened, if the
system is running on battery power. This flag is supported only on
systems that support resume timers.

UI says "Wake the computer to run this task"

I hope this post turns out to be useful to folks.

--Dale--


This is likely how you got to this post in the first place:

schtasks.exe (Windows schtasks command)
at.exe (Windows AT command)
win32 api
windows scheduled tasks
create scheduled tasks from the command line that wakes the computer
to run the task
create scheduled tasks programatically that wakes the computer to run
the task
command line task scheduling that wakes the computer to run the task
power management
resume the computer to run the task
wake the computer to run the task
awaken the computer to run the task
WIN32_ScheduleJob WMI obect
NetScheduleJobEnum
NetScheduleJobDel
NetScheduleJobAdd
netapi32.dll

0 new messages