Sysinternals Homepage
Forum Home Forum Home > Windows Discussions > Troubleshooting
  New Posts New Posts RSS Feed: Remote Desktop After Wol(Wake on Lan)
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Remote Desktop After Wol(Wake on Lan)

 Post Reply Post Reply Page  <1234>
Author
Message
  Topic Search Topic Search  Topic Options Topic Options
Shaker View Drop Down
Newbie
Newbie
Avatar

Joined: 10 June 2009
Location: Roesrath - DE
Online Status: Offline
Posts: 8
  Quote Shaker Quote  Post ReplyReply Direct Link To This Post Topic: Remote Desktop After Wol(Wake on Lan)
    Posted: 10 June 2009 at 10:05am
Originally posted by muotoko

When I resume with wol, it wakes and the display wakes up also so that works, but it goes right back to sleep in a couple of minutes.


Hi! After looking around everywhere ;) on the web, this seems to be the most promising thread dealing with this problem. I have exactly the same demand !

I am a programmer myself and I think I understand the SetThreadExecutionState() API function. In the nice .cs file here the only intention currently is to turn on the display upon wake-up, not to keep the system alive.

Since I am very eager to solve this problem it is very likely that I modify the code and post it back here after successful testing later today. Like midnight or so... things to do until then... I will try to re-code the service, so that it keeps the system awake (not necessarily the display), and maybe it will also react to user inputs (keyboard) and then turn off its actions to "get back to normal", letting system idle timer to its job ;)
Back to Top
Shaker View Drop Down
Newbie
Newbie
Avatar

Joined: 10 June 2009
Location: Roesrath - DE
Online Status: Offline
Posts: 8
  Quote Shaker Quote  Post ReplyReply Direct Link To This Post Posted: 11 June 2009 at 1:27am
I think, I did it!
Usually my PC returned to sleep after 9 minutes ! (Somehow not 120 seconds unattended idle timer).
With the service installed and running, it stays on beyond these 9 minutes even after WOL !

binary file: http://freeware.satria.de/StayAwake/StayAwake.exe
source code: http://freeware.satria.de/StayAwake/StayAwake.cs

Corrected EventLog-handling.
Added more log-messages.
Added the API-call to keep system awake (not only display refresh as before)
Added a 60-seconds "keep-alive" timer because the API-call didn't do it :)

Build is up to you, if you like.
Installation of the exe works as described before:
...\InstallUtil StayAwake.exe

Logs into the Application EventLog. For more logging add the parameter to the service-image (in Windows REgistry): /debug

Enjoy WOL and remote desktop ;)
Back to Top
mguinness View Drop Down
Newbie
Newbie


Joined: 19 May 2009
Online Status: Offline
Posts: 9
  Quote mguinness Quote  Post ReplyReply Direct Link To This Post Posted: 06 July 2009 at 9:45pm
Nice job Shaker.  I haven't used the code myself as I've not had the timeout issue, but hopefully this code will work for muotoko too.  Thanks for sharing.
Back to Top
Innocence View Drop Down
Newbie
Newbie


Joined: 21 July 2009
Online Status: Offline
Posts: 4
  Quote Innocence Quote  Post ReplyReply Direct Link To This Post Posted: 21 July 2009 at 9:39am
Originally posted by Shaker

I think, I did it!
I've got the same issue with my MediaPC, stuck in the basement on Standby and only waking up when a device needs it or it needs to do nightly housekeeping (backups etc.). This infamous System Idle Timer problem is the last thing I needed a fix for, so I'll test it tonight.
 
If it works you're my hero :)
Back to Top
Innocence View Drop Down
Newbie
Newbie


Joined: 21 July 2009
Online Status: Offline
Posts: 4
  Quote Innocence Quote  Post ReplyReply Direct Link To This Post Posted: 22 July 2009 at 7:41am

Ok, so you ARE my hero! :D

After installing StayAwake, for the first time in weeks my server didn't automatically return to standby after waking up at midnight!!! Clap
 
Incidentally, the problem with the server returning to standby *doesn't* happen when it's awakened by WOL - it only happens when I use Windows Task Scheduler to automatically wake up the machine (at midnight).
 
The server is running a looping batch script (as a Windows Service) which checks for activity on certain network ports. If there's no activity it starts a 5 minute countdown (which naturally is reset if activity is detected). After 5 minutes without activity the script sends the server into Standby mode. The server wakes up if it receives a WOL packet and the script resumes. At midnight, Windows Task Scheduler wakes up the machine and the script resumes as normal. When the script discovers it's after midnight it performs various housekeeping tasks, like staring the backup utility, updating EPG etc. Once all tasks have finished it returns to the standard loop, and if no activity is detected during the 5 minute countdown it performs a full shutdown/power off. At 6 in the morning, the PC BIOS powers on the computer and the whole thing starts again :)
Back to Top
Shaker View Drop Down
Newbie
Newbie
Avatar

Joined: 10 June 2009
Location: Roesrath - DE
Online Status: Offline
Posts: 8
  Quote Shaker Quote  Post ReplyReply Direct Link To This Post Posted: 22 July 2009 at 9:10am
That's nice :) Good to see, that the tool is useful to others, too.

Obvious to see, that such activities like the ones of your midnight-PC ;) must fail because of this return-to-sleep, unless the running applications themselves activate the "stay-awake"-mechanism.
Back to Top
gorman69 View Drop Down
Newbie
Newbie


Joined: 03 February 2008
Online Status: Offline
Posts: 10
  Quote gorman69 Quote  Post ReplyReply Direct Link To This Post Posted: 07 September 2009 at 7:53am
Shaker, you are my hero too!!!

I was trying to use the WakeOnStandby tool but was having the "sleep after two minutes" problem. Your service worked perfectly and now my machine behaves like *I* want it to.

One thing: would this be needed on Windows 7? In case it would, is your code compatible with 7?

Again thank you!!!
Back to Top
Shaker View Drop Down
Newbie
Newbie
Avatar

Joined: 10 June 2009
Location: Roesrath - DE
Online Status: Offline
Posts: 8
  Quote Shaker Quote  Post ReplyReply Direct Link To This Post Posted: 07 September 2009 at 8:43am
Thanks for your nice feedback :)
I am unsure about the compatibility with Windows 7, since already in Vista you have the possibilty to midify this unattended idle timer with some registry trick, I think. So you might not even need my tool anymore.
I would'n expect the API to change that much, but ... I have never tried. Windows 7 is not out yet ;)
Back to Top
XVIEWER View Drop Down
Newbie
Newbie


Joined: 23 September 2009
Online Status: Offline
Posts: 1
  Quote XVIEWER Quote  Post ReplyReply Direct Link To This Post Posted: 23 September 2009 at 11:35pm
Nice Little App Shaker, I have successfully used stayawake.exe on my Media PC/NAS.
When it wakes up from user input it will go back to sleep after 2 hours of inactivity.
I was facing the same WOL 2 minute timeout problem until I installed stayawake.exe.
Now when it is woken by WOL / Directed Packed for NAS usage it would then not return
back to sleep.
For any one intrested I used a little 30 Day Trial application called GigAlarm (v1.34) current on 24-09-09. And set to Once Idle for 60 minutes goto Standby. Gigalarm is currently only
$10 so it is a cheap solution to solve my headache.
I'm also using an Open Source Application called Eventghost to start Gigalarm
only when "System.AutomaticResume" is called. If "System.Resume" is executed
eventghost will then taskkill gigalarm and move the mouse over the system tray to remove tray icon.

Back to Top
msmith8228 View Drop Down
Newbie
Newbie
Avatar

Joined: 01 October 2009
Online Status: Offline
Posts: 2
  Quote msmith8228 Quote  Post ReplyReply Direct Link To This Post Posted: 01 October 2009 at 7:42pm
This is getting close to perfect -- but there is still one final issue outstanding with WOL and stayawake.exe!
 
Many thanks to everyone who has worked on this project-- I have tested this on a number of my media PC's and the first and second issues with WOL and remote wakeup have been fixed.
 
1. Fixed -- Remote monitor comes on correctly
2. Fixed -- Remmote system does not return to suspend mode is 120 seconds
3. Not Working -- automatically running a program after resune from suspend
 
The third issue -- it is possible to run a program automatically when a system comes out of suspend mode -- there are a number of programs that will do this (hibernate trigger is one and there are a number of VB scripts floating around that do the same thing). I have tested stayawake.exe and it will not allow the automatic programs to run on any of my systems when they recieve the WOL packet. If I move the mouse on the remote system -- then the automatic process will start.
 
This automatic running of a program / script / batch file after a resume from suspend is important for systems that need such things as drivers restarted / reset -- a somewhat common issue with media PC's.
 
Can anyone look into this last problem and see if there is a solution that can be added to stawawake.exe?
 
Back to Top
 Post Reply Post Reply Page  <1234>

Forum Jump Forum Permissions View Drop Down

Privacy Statement