Solved

run script after standby windows xp

Posted on 2009-07-01
3
732 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

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…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

860 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