Solved

run script after standby windows xp

Posted on 2009-07-01
3
725 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This video discusses moving either the default database or any database to a new volume.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

707 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now