Jump to content

Help me solve a bizarre scheduled tasks conundrum... Please!


Mr. H
 Share

Recommended Posts

O.K., here's the deal:

I'm running Windows 2000. I schedule a task to open a command window, and in the advanced properties set Windows to wake the computer in order to run the task. Let's call this task "Wake Up".

If I put the computer into hibernation manually by going to Start->Shutdown->Hibernate->O.K., the scheduled task "Wake Up" will successfully awaken the computer.

It is possible to schedule Windows 2000 to enter hibernation by executing the command "C:\WINNT\system32\rundll32.exe PowrProf.dll, SetHibernateState". However, if I do that, the machine hibernates at the correct time, but "Wake Up" will not wake up the computer at the designated time!! (it is possible to manually awaken the computer by pressing the power button, Windows restores just fine)

What's going on?

The only thing I can think of, is that in Scheduled tasks, you can choose which user the tasks should be run as. If I am logged in as "Mr. H", for argument's sake, is it actually the "Mr. H" user that runs the hibernate command if I go to Start->Shutdown->Hibernate->O.K.?

Any other ideas?

Link to comment
Share on other sites

I believe its because your only asking rundll.exe to perform that one function not to wake up also.

I don't think you understand.

I have two scheduled tasks. One that executes the command - which I quoted wrong in my first post, it is actually: - "C:\WINNT\system32\rundll32.exe PowrProf.dll, SetSuspendState", which hibernates the computer.

The other is a scheduled task to launch a command window. This scheduled task has the option "wake computer to perform this task" set. If I initiate a hibernate manually, this second task will successfully wake up the computer. However, it will not wake up the computer if the hibernate is initiated with the command "C:\WINNT\system32\rundll32.exe PowrProf.dll, SetSuspendState".

Obviously, there must be a difference between a manually initiated hibernate (by going Start->Shutdown->Hibernate->O.K.) and the hibernate initiated by "C:\WINNT\system32\rundll32.exe PowrProf.dll, SetSuspendState", but I have no idea what that difference is. Both methods look the same in that, in both cases, Windows brings up a dialogue that says "preparing to hibernate" and then a progress bar as RAM is copied to the HDD, and then the computer shuts off.

Link to comment
Share on other sites

Well, I've solved the problem, without really figuring out what was wrong. If anyone knows, please let me know.

What I did was this:

I got hold of the free program, "Auto Hot Keys", and wrote a script to send the following keyboard command sequence: "left windows key" (selects the start menu), "up key" (selects shut down), "return" (brings up shut down dialogue box), "h" (ensures hibernate option is selected), "return" (activates hibernation). I then compiled the script as an application, and scheduled that application to hibernate the machine. And my "wake up" scheduled task will wake up the machine in that situation. So, it's a bit of a "kludge", but it works.

Link to comment
Share on other sites

I'm not a programmer so I don't know much about this stuff, but the SetSuspendedState function is supposed to take three boolean arguments.

· Hibernate

Specifies the state of the system. If TRUE, the system hibernates. If FALSE, the system is suspended.

· ForceCritical

Forced suspension. If TRUE, the function broadcasts a PBT_APMSUSPEND event to each application and driver, then immediately suspends operation. If FALSE, the function broadcasts a PBT_APMQUERYSUSPEND event to each application to request permission to suspend operation.

· DisableWakeEvent

If TRUE, the system disables all wake events. If FALSE, any system wake events remain enabled.

Rundll32 doesn't accept them like it does with others such as the ones for the control panel applets. I think don't think PowrProf.dll excepts arguments as well. When I monitored what files and registry keys were being looked at while the computer was going into hibernation in both method I got different results. Thats good you got it working another way.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy