Solved

run script after standby windows xp

Posted on 2009-07-01
3
733 Views
Last Modified: 2012-05-07
Hi Experts,

I have a customer that we have created a script to automatically run a dialup network connection / vpn connection / rdp connection on computer startup. The scripts work well. I would like to however have these scripts automatically run when the computer comes out of standby.

Is there a way to automatically run batch scripts out of standby?

Thanks
smbcs
0
Comment
Question by:smbcs
  • 2
3 Comments
 
LVL 4

Expert Comment

by:asrdias
ID: 24761396
Try this:

Reference documentation here: http://msdn.microsoft.com/en-us/library/aa394362(VS.85).aspx

Example Script...

'Script type VBS starts'

Set oShell = CreateObject("WScript.Shell")
Set colMonitoredEvents = GetObject("winmgmts:").ExecNotificationQuery("Select * from Win32_PowerManagementEvent")
Do
  Set oSuspend = colMonitoredEvents.NextEvent
  If oSuspend.EventType = 7 Then
    'Here you insert the code to lauch whatever you need'
    MsgBox "Waking up !"
  End If
Loop

'Script Ends
0
 
LVL 4

Accepted Solution

by:
asrdias earned 500 total points
ID: 24761408
Posting the script again due to line break...

Example Script...

'Script type VBS starts'

Set oShell = CreateObject("WScript.Shell")
Set colMonitoredEvents = GetObject("winmgmts:").
_ExecNotificationQuery("Select * from Win32_PowerManagementEvent")

Do
  Set oSuspend = colMonitoredEvents.NextEvent
  If oSuspend.EventType = 7 Then
    'Here you insert the code to lauch whatever you need'
    MsgBox "Waking up !"
  End If
Loop

'Script Ends
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question