views:

335

answers:

3

What's the best way to programmatically cause a Windows XP (or above) machine to wake up at a specific time. (Ideally a lot like how Media Center can start up automatically to record a particular TV program)

I've got a Windows service (written in C#) and I'd like this service to be able to cause the machine it is hosted on to start up at predetermined times.

Are there any BIOS settings or prerequisites (eg. ACPI) that need to be configured for this to work correctly?

This machine would be using dialup or 3G wireless modem, so unfortunately it can't rely on Wake on LAN.

A: 

Some machines have a BIOS alarm clock that can be set to wake up the computer at a certain hour. It should be possible to program this clock, but I don't know the specific details.

Edit: I found this program that should let you set the time. It's in C, under Linux, but maybe it can give you some hints.

A warning though: before trying anything that changes the BIOS settings directly be sure to write down every setting from BIOS screens, because in case of an error the BIOS might revert to factory default and you might need to set it up again as it was.

rslite
+1  A: 

Your best bet is using Wake on LAN capability. This will require another machine to send a packet of a special kind to wake your machine up.

This will not be helpful if your machine is not connected to the network or you for some reason don't wasnt to move this logic onto another machine. But it's useful for some configurations where you have multiple machines and want to wake them up programmatically.

sharptooth
+1  A: 

The task scheduler program in Win7, taskschd.msc (and I beleive XP as well) can be set to wake the system on different triggers. Those triggers can be schedule, time, event, etc.

In at least Win7, you need to set "Allow Wake Timers" to 'Enabled' for this to work. This setting is found under...

--> Control Panel\Hardware and Sound\Power Options
click - "Edit Plan Settings"
click - "Change advanced power setting"
expand - "Sleep"
Expand - "Allow Wake timers"

etropic
I think this is getting closer to the real answer. As I want to do this programmatically, I want to know what API to use to set a 'wake timer'
David Gardiner
Well, task scheduler in Win7 is different from the one in XP. For XP you can use the at command (http://support.microsoft.com/kb/313565) or the Task Scheduler 1.0 API (http://msdn.microsoft.com/en-us/library/aa383579(VS.85).aspx). You have a wrapper in http://www.codeproject.com/KB/cs/tsnewlib.aspx. While in Windows 7 you have the new 2.0 API (http://msdn.microsoft.com/en-us/library/aa384138(VS.85).aspx)
jmservera