Pyryara
Had this question 5
Question
Pyryara asked on
| 9992 views

Running program on return from standby/hibernate

Hey there,
I'd like to run a program every time that I come back/sign on to my computer after standby/hibernation mode. I have only found a possibility to play a logon sound every time that happens, but I can not run programs that way. Is it possible to do this in Vista?

PS: If it isn't, can you send that supposedly easy feature request to the Windows 7 development team?
Tiffany McLeod
Found this helpful 5
Answer
Tiffany McLeod replied on
While Mark's instructions look as if they will work, there is a more elegant way to accomplish this, using Vista's built in Task Scheduler. 

To create a task that will run whenever you Unlock your Profile: 

1. Open Task Scheduler [Start> Control Panel> System and Maintenance> Administrative Tools> Task Scheduler (or just type "task Scheduler" into the Start Search box)]. You will need an Administrator's Account/Password to access this.

2. Select "Create a Task" to create a new task. 

3. A panel with several tabs will open. 

4. Fill the "General" tab to suit your needs. 

5. Switch to the "Triggers" tab and choose "new". Another Panel will open. At the top of this Panel, you will see a drop-down menu (see below). Open it and choose "At Workstation Unlock". Then choose whether you would like this task to run just for your profile or for everyone's. Click "ok". (You may find it useful to use the "Delay task for" option to delay the task for 15/30 seconds to give your desktop a chance to load before the program runs.)
 

6. Switch to the Actions tab, select "new", choose "Run a Program", and browse to the program you wish to run. 

7. Switch to the "Conditions" & "Settings" tabs, respectively, and change the various settings to suit your needs. (Make sure that the "Run on AC Only" option is unchecked if you are using a laptop and want the task to run when it is unplugged.)

8. Click ok to save your new task. 

Now, whenever you unlock your profile after sleep or hibernate, your program will run. 

If you follow these instructions, but choose "At Login" instead of "At Workstation Unlock", your task will run whenever you login (unlock and login are not the same thing as far as the computer is concerned, so keep that in mind).

 This may not work if your profile is not protected with a password, but all mine are, so I wasn't able to test it in that situation.

Hopefully this will fill your needs.

Best Wishes,
BookwormDragon
Mark L. Ferguson
Found this helpful 0
Mark L. Ferguson replied on
Scripting will do that for you. You create a .VBS file in Notepad with any name you like, containing this code, and run it, to then hibernate before it finishes the sleep and starts your app.

assuming the app starts from the command 'c:\myfolder\myapp.exe'

--my.vbs  -- cut here--
set shell=createobject("wscript.shell")
wscript.sleep 120000  ' this waits two minutes
shell.run "c:\myfolder\myapp.exe"
--end file cut here---

Rating posts helps other users
Mark L. Ferguson MS-MVP
Rating posts helps other users
Mark L. Ferguson (former MVP)
Tiffany McLeod
Found this helpful 5
Answer
Tiffany McLeod replied on
While Mark's instructions look as if they will work, there is a more elegant way to accomplish this, using Vista's built in Task Scheduler. 

To create a task that will run whenever you Unlock your Profile: 

1. Open Task Scheduler [Start> Control Panel> System and Maintenance> Administrative Tools> Task Scheduler (or just type "task Scheduler" into the Start Search box)]. You will need an Administrator's Account/Password to access this.

2. Select "Create a Task" to create a new task. 

3. A panel with several tabs will open. 

4. Fill the "General" tab to suit your needs. 

5. Switch to the "Triggers" tab and choose "new". Another Panel will open. At the top of this Panel, you will see a drop-down menu (see below). Open it and choose "At Workstation Unlock". Then choose whether you would like this task to run just for your profile or for everyone's. Click "ok". (You may find it useful to use the "Delay task for" option to delay the task for 15/30 seconds to give your desktop a chance to load before the program runs.)
 

6. Switch to the Actions tab, select "new", choose "Run a Program", and browse to the program you wish to run. 

7. Switch to the "Conditions" & "Settings" tabs, respectively, and change the various settings to suit your needs. (Make sure that the "Run on AC Only" option is unchecked if you are using a laptop and want the task to run when it is unplugged.)

8. Click ok to save your new task. 

Now, whenever you unlock your profile after sleep or hibernate, your program will run. 

If you follow these instructions, but choose "At Login" instead of "At Workstation Unlock", your task will run whenever you login (unlock and login are not the same thing as far as the computer is concerned, so keep that in mind).

 This may not work if your profile is not protected with a password, but all mine are, so I wasn't able to test it in that situation.

Hopefully this will fill your needs.

Best Wishes,
BookwormDragon
Pyryara
Found this helpful 0
Pyryara replied on

Reply

Mark,
thanks for your answer, but I find that solution not that much better. Instead of having to start a program manually after return from hibernate, now I have to start that script manually before going to hibernate.

BookwormDragon,
thanks, that hint was very useful indeed, works like a charm! Do you know if there is also a method to achieve this with Windows XP SP3? When I create a new task there, the option "At Workstation Unlock" is not available.
Tiffany McLeod
Found this helpful 0
Tiffany McLeod replied on

Reply

I'm glad you found it useful. I don't believe the option is available under XP, although I could be wrong. If it is available, it is very well hidden, since I haven't been able to find it yet.
Jurrit
Found this helpful 0
Jurrit replied on

Reply

 This may not work if your profile is not protected with a password, but all mine are, so I wasn't able to test it in that situation.

This is indeed the case. But every time a PC resumes back from hibernate a specific event is created with the following characteristics:
Log Name: System
Source: Power-Troubleshooter
Event-ID: 1

The above event can be used as trigger in the instructions of Tiffany McLeod. At number 5 you can do the following:

5. Switch to the "Triggers" tab and choose "new". Another Panel will open. At the top of this Panel, you will see a drop-down menu. Open it and choose "On an event". Choose "System" from the pull down menu at the "Log" entry. Choose "Power-Troubleshooter" at the "Source" entry. The "Event ID" should be "1".



This worked for me, now my script will execute just after the PC resumes from hibernate.



eeswaratluri
Found this helpful 0
eeswaratluri replied on

Reply

i cant add a dail up connection to task sheduler,it says "no such interface supported"
how to add dail up connection as run program,onece  it gete open my internet connection can start
lemoncurry_01
Found this helpful 0
lemoncurry_01 replied on

Reply

This is indeed the case. But every time a PC resumes back from hibernate a specific event is created with the following characteristics:
Log Name: System
Source: Power-Troubleshooter
Event-ID: 1

I know this is an old post, but this describes exactly what I need to, so.... its not old anymore!

I have this same requirement, to run a network-shares.BAT file in windows 7 Ultimate.

The file runs at PC start-up, and sets up the mapped drives in non-persistent mode to workaround the bug in w7 that stalls the PC when shared network drives become unavailable.

This indeed is the event that can be used to trigger running programs at wakeup.

I found however that I needed to create the task Schedule from within the the Event Viewer,

Creating the task from within the Task scheduler did not work for some reason.

Thanks.