Wake from Standby question

(imported topic written by jamieorth91)

This maybe an incorrect setup on my part, or maybe something with Dell computers. Here is the situation:

Power profiles have the computers go into standby after 30 minutes of inactivity.

A Wake-from-Standby scheduling wizard was run to have computers come out of standby at 1 am for patch management, etc. This seams to be working fine.

The issue is when we have computers that are not being used (so they are in standby mode) and we want to wake them up. In our lab test the right click option “Send wake on Lan request” will wake the machine up for 1 minute - we can ping the ip address for that duration and then the machine goes back to sleep - even though the last “user” had the profile to wait 30 minutes. These are Dell Optiplex pc’s - new ones, models 755, 330, etc…

Now, if we shut the machine completely off, the “Send wake on Lan request” works as intended, the pc wakes up and stays on for the 30 minute duration. Any ideas??

(imported comment written by BenKus)

Hi Jamie,

Ahh… you are experiencing the dreaded “PC Narcolepsy” problem (as opposed to a separate and potentially more problematic “PC Insomnia”).

The problem is the Windows “Unattended Idle Timer”. Here is some info in the Windows programmer’s reference: http://msdn.microsoft.com/en-us/library/aa373235(VS.85).aspx

Here is a description of the issue as I understand it:

By Microsoft’s design, if you wake-up a computer from standby with a wake-on-lan packet, the computer will start the “Unattended Idle Timer”. If no keystroke/mouse movement is detected for 2 minutes, the system will go back to sleep. This is unfortunately not configurable (at least not in XP… I believe it is configurable for Vista). Of course, this is an issue for using wake-on-lan for standby mode because it limits the time-window you can reasonably perform tasks.

Couple notes on this:

  • You will often not see this issue if your computers suffer from “PC Insomnia”, which causes your computers to refuse to go into Standby in many cases (this turns out to be quite a lot of systems and we have Fixlet content in the BigFix Power Management site that helps you get around the PC Insomnia issues).

  • We are working on a solution to this issue, but we haven’t released it into the product yet… but if you want to contact me directly, I can work with you to implement it in your test environment and see if it will work for you.

  • I know a few of our customers have been contacting MS directly to ask how to configure the Unattended Idle Timer in Windows XP… You might want to check with them and if they give you a mechanism to control this, we can help you use BigFix to configure it…

Thanks,

Ben

(imported comment written by jamieorth91)

“pc narcolepsy” - thats the one thing I didn’t Google!!! Ben - you are the man, I have been going crazy with this… yes, I would be interested on the solution you are working on. One of my coworkers was asking if we could use a vbscript to do a “sendkeys”. I will email you directly.

Thanks!!!

(imported comment written by BenKus)

For the purposes of documentation:

I am claiming to have coined the phrase “PC Narcolepsy” to describe this issue. “PC Insomnia” had been coined by someone else and I think narcolepsy followed naturally to characterize this issue. My co-workers will point out that they once found a forum entry on another site that used the term a few months back, but I am adament that I had been using the term even longer than that…

I am proud to report that at the time of this writing, this posting is the top Google entry for “PC Narcolepsy”. :slight_smile:

And to answer your question:

We think we have a way to address this issue by having an app tell Windows not to go to sleep, but it needs to be running at the time of wake-up… I will send you some more info about this…

Ben

(imported comment written by jamieorth91)

Cool - we will be glad to share some of our progress as well. We wrote an app - but it’s only working part of the way…it does turn on the monitor (which we want for VNC to work), and we have also thought about having a fixlet tied to the WOL somehow that restarts the computer(s) in question, with a restart we know the idle timer would be reset… I look forward to hearing from you.

(imported comment written by jr6591)

Ben,

Any updated info on this?

Thanks

(imported comment written by jr6591)

Ben,

Any updates?

(imported comment written by BenKus)

Hi jr,

Sorry for not responding until now… I sometimes miss these posts…

Short answer is that we worked with Jamie Orth for a little while, but we didn’t get very far (the project was canceled).

We are open to working with other customers if you help us do some testing in real-world scenarios…

Ben

(imported comment written by BenKus)

Hey guys,

We have been working with a couple of customers and we think we have an interim solution to the PC Narcolepsy problem… It uses some work that was done on http://forum.sysinternals.com/forum_posts.asp?TID=18896&PN=3

See the attached Fixlet that should help prevent PC Narcolepsy by installing a small service that simply prevents the computer from going back to sleep…

Please be sure to read the Fixlet description for more information:

PC Narcolepsy refers to the problem where a computer that is woken from standby will go back into standby after a couple minutes unless it is woken with user input device (such as a mouse/keyboard). This problem occurs when you use wake-on-lan or scheduled wake-from-standby capabilities to wake up a computer when no user is present.

The reason this problem occurs is due to the Windows “Unattended Idle Timer” which is not configurable in Windows XP.

StayAwake is a simple tool available at satria.de that will run in the background and reset the “Unattended Idle Timer” after a computer is woken up (by wake-on-lan, wake-from-standby, or other mechanisms). The end-result is that you don’t need to worry about your computers immediately falling asleep after you wake them up.

You must have .NET Framework 2.0 installed for this Fixlet to be relevant (and to use the StayAwake tool). Also this Fixlet requires 32-bit XP to be relevant. StayAwake is 20kb.

Note that BigFix did not provide the stayawake.exe tool for this Fixlet so it is downloaded from the satria.de site.

We have had at least one customer test and confirm that this was working, but please do extensive testing on your own systems if you wish to use it.

Note that BigFix is looking into including this functionality into the base product (so you don’t need to download another tool) for a future power management release.

Please post your experiences if you try this out.

Thanks,

Ben

(imported comment written by SY57_Jim_Montgomery)

I have a test machine that was experiencing PC Narcolepsy. I’ve imported and deployed this package and the machine does stay on past the two minutes now.

Actually, he stayed on well longer than his Power Profile too, so he’s gone right from being narcoleptic to insomnia. After applying the “Force Standby in PC Insomnia Conditions” task, he went right back to sleep though.

It’s like mixing cough syrup with caffeine.

I talked with my Microsoft Tech rep about it going back to sleep after 2 minutes, and he only provided the Windows API call to prevent the narcoleptic behavior. This is the same API this service uses, so MS wasn’t much help this time around.

–Jim

(imported comment written by MattBoyd)

The service is designed to keep the machine awake until there is user interaction or the machine is rebooted. I agree, MS hasn’t been much help here.

(imported comment written by jr6591)

Fixlet didn’t seem to work. Pending Download. I had to download the file and change the action script. Is there an uninstll fixlet floating around.

(imported comment written by MattBoyd)

I don’t know of any installer, but I think this will uninstall the service:

parameter “loc” = “{pathname of parent folder of regapp “BESClient.exe”}\StayAwake”

waithidden “{pathname of windows folder}\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe” /u “{parameter “loc”}\StayAwake.exe”

(imported comment written by MattBoyd)

By the way, I came across a solution for adjusting the return to standby timeout for Windows 7 today: http://www.sevenforums.com/tutorials/35767-sleep-return-timeout-unattended-wake-up.html .

(imported comment written by StacyLee)

so did adjusting this key timeout stop the machine from going back to sleep after 2 min of no activity? If so what time out did you set?

We have implemented custom power profile settings using the Power Profile Wizard.

In this snippet of the action:

waithidden cmd.exe /C powercfg.exe -duplicatescheme 381b4222-f694-41f0-9685-ff5bb260df2e

it looks as if the custom action is copied from the Balanced default profile. So where is the custom profile stored in the registry? (GUID ?)

I’d like to then go in and adjust the AC timeout settings.

thanks

(imported comment written by MattBoyd)

Stacy Lee

so did adjusting this key timeout stop the machine from going back to sleep after 2 min of no activity? If so what time out did you set?

To be honest, I haven’t actually tested it. I’m fairly certain that it will work though.

Stacy Lee

We have implemented custom power profile settings using the Power Profile Wizard.

In this snippet of the action:

waithidden cmd.exe /C powercfg.exe -duplicatescheme 381b4222-f694-41f0-9685-ff5bb260df2e

it looks as if the custom action is copied from the Balanced default profile. So where is the custom profile stored in the registry? (GUID ?)

I’m not sure where the profiles are stored are in the registry, but I wouldn’t recommend editing them through the registry. I would use POWERCFG.EXE instead. I recently wrote two articles about Power Management in Windows 7 that may help you understand how to use POWERCFG.EXE:

I have made some modifications to the action script generated by the power profile wizard in order to apply custom settings to custom power profiles by using POWERCFG -SETACVALUEINDEX.

The trick is that you need the GUID that’s associated with your custom power profile. You can get this by using relevance, and the power wizard has actually done that already.

For example, I wanted to enable the setting that allows Windows 7 computers to enter standby when they are connected to remote file shares. Here’s what the original action script that the power wizard made:

// This block of action will only run on Windows Vista and 7 computers:
if {name of operating system = “WinVista” or name of operating system = “Win7”}

waithidden cmd.exe /C powercfg.exe -list > __list

if {exists file “__list” whose (exists line whose (it contains “(CLM Podium No User 15-20-30)” ) of it)}
waithidden cmd.exe /C powercfg.exe -setactive {(if (exists lines whose (it contains “(CLM Podium No User 15-20-30)”) of it) then (preceding text of first “(” of following text of first “:” of concatenations of (lines whose (it contains “(CLM Podium No User 15-20-30)”) of it) of file “__list”) else (“381b4222-f694-41f0-9685-ff5bb260df2e”) ) of file “__list”}

delete __list
else
waithidden cmd.exe /C powercfg.exe -duplicatescheme 381b4222-f694-41f0-9685-ff5bb260df2e > __guid
waithidden cmd.exe /C powercfg.exe -changename {preceding text of last “(” of (following text of first ": " of (line 1 of file “__guid”))} "CLM Podium No User 15-20-30"
waithidden cmd.exe /C powercfg.exe -setactive {preceding text of last “(” of (following text of first ": " of (line 1 of file “__guid”))}

waithidden cmd.exe /C powercfg.exe -change -monitor-timeout-ac 15
waithidden cmd.exe /C powercfg.exe -change -monitor-timeout-dc 15
waithidden cmd.exe /C powercfg.exe -change -disk-timeout-ac 20
waithidden cmd.exe /C powercfg.exe -change -disk-timeout-dc 20
waithidden cmd.exe /C powercfg.exe -change -standby-timeout-ac 30
waithidden cmd.exe /C powercfg.exe -change -standby-timeout-dc 30
waithidden cmd.exe /C powercfg.exe -hibernate off

I made a few minor modifications so that I could retrieve the power profile GUID. I wrote the guid to a text file (powerguid.txt) so that I can reference it in my powercfg -SETACVALUEINDEX command at the bottom. The parts I added are in bold. I also color coded the duplicated relevance so that you (hopefully) understand where I got it from.

// This block of action will only run on Windows Vista and 7 computers:
if {name of operating system = “WinVista” or name of operating system = “Win7”}

waithidden cmd.exe /C powercfg.exe -list > __list

if {exists file “__list” whose (exists line whose (it contains “(CLM Podium No User 15-20-30)” ) of it)}
waithidden cmd.exe /C powercfg.exe -setactive color=green{(if (exists lines whose (it contains “(CLM Podium No User 15-20-30)”) of it) then (preceding text of first “(” of following text of first “:” of concatenations of (lines whose (it contains “(CLM Podium No User 15-20-30)”) of it) of file “__list”) else (“381b4222-f694-41f0-9685-ff5bb260df2e”) ) of file “__list”}[/color]

//begin addition by boyd
createfile until END
color=green{(if (exists lines whose (it contains “(CLM Podium No User 15-20-30)”) of it) then (preceding text of first “(” of following text of first “:” of concatenations of (lines whose (it contains “(CLM Podium No User 15-20-30)”) of it) of file “__list”) else (“381b4222-f694-41f0-9685-ff5bb260df2e”) ) of file “__list”}[/color]
END
copy __createfile powerguid.txt
//end addition by boyd
delete __list
else
waithidden cmd.exe /C powercfg.exe -duplicatescheme 381b4222-f694-41f0-9685-ff5bb260df2e > __guid
waithidden cmd.exe /C powercfg.exe -changename {preceding text of last “(” of (following text of first ": " of (line 1 of file “__guid”))} "CLM Podium No User 15-20-30"
waithidden cmd.exe /C powercfg.exe -setactive color=blue{preceding text of last “(” of (following text of first ": " of (line 1 of file “__guid”))}[/color]

//begin addition by boyd.
createfile until END
color=blue{preceding text of last “(” of (following text of first ": " of (line 1 of file “__guid”))}[/color]
END
copy __createfile powerguid.txt
//end addition by boyd

delete __guid
endif

waithidden cmd.exe /C powercfg.exe -change -monitor-timeout-ac 15
waithidden cmd.exe /C powercfg.exe -change -monitor-timeout-dc 15
waithidden cmd.exe /C powercfg.exe -change -disk-timeout-ac 20
waithidden cmd.exe /C powercfg.exe -change -disk-timeout-dc 20
waithidden cmd.exe /C powercfg.exe -change -standby-timeout-ac 30
waithidden cmd.exe /C powercfg.exe -change -standby-timeout-dc 30
waithidden cmd.exe /C powercfg.exe -hibernate off

// begin addition by boyd. Sets the allow sleep on open remote file
waithidden cmd.exe /C powercfg -SETACVALUEINDEX {line 1 of file “powerguid.txt” as trimmed string} fea3413e-7e05-4911-9a71-700331f1c294 0e796bdb-100d-47d6-a2d5-f7d2daa51f51 1
waithidden cmd.exe /C powercfg -SETDCVALUEINDEX {line 1 of file “powerguid.txt” as trimmed string} fea3413e-7e05-4911-9a71-700331f1c294 0e796bdb-100d-47d6-a2d5-f7d2daa51f51 1
delete powerguid.txt
// end addition by boyd

I didn’t make any changes to the applicability relevance. I didn’t need to…

I’m sorry if this looks a bit overwhelming. I tried to think of the easiest way to explain it. I’d be happy to elaborate if you have any questions.

Hopefully, this is something that BigFix will consider adding to the power profile wizard.

(imported comment written by BenKus)

It looks like the author updated the executable and so the Fixlet posted above will fail to download… A quick look at the site shows that the file has changed with the new size/sha1… To fix the Fixlet, you can manually adjust the actionscript from:

prefetch StayAwake.exe sha1:a75cdc24cda0d841a121f4c0d8905b7cccb89e3a size:20480 http://freeware.satria.de/StayAwake/StayAwake.exe

to:

prefetch StayAwake.exe sha1:56343dec2b3cc7c0afcf5cda60c7d0443896b8d6 size:24576 http://freeware.satria.de/StayAwake/StayAwake.exe

Note that I haven’t verified that the new file will work so you will want to test before using…

Ben

(imported comment written by gcibirch91)

I have made a copy of the original and amended it with the new bit.

Thanks

Lee