Solved

run script after standby windows xp

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

770 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