Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Detect Restart from Hybernate or Stand By

99 views
Skip to first unread message

Harlan Grove

unread,
Jun 16, 2008, 10:44:06 PM6/16/08
to
Is there a way to detect restarting from hybernate or stand by states
that I could use to run batch files?

My laptop has a mouse touchpad controller applet that puts an icon
into the system tray. I'm in the habit of hiding that icon whenever it
appears. It appears every time my laptop restarts from hybernate or
stand by states, so I figure there's a background process that puts
the icon back in the system tray on restart. While one of the things I
want to do is automate hiding this icon, I'd also like to check and do
other things on restarts.

billious

unread,
Jun 17, 2008, 12:38:08 AM6/17/08
to

"Harlan Grove" <hrl...@gmail.com> wrote in message
news:4383036a-1cce-4152...@v1g2000pra.googlegroups.com...

Perhaps this might be of use :
http://www.pcreview.co.uk/forums/thread-1495473.php

Pertinent portion of the response:


You can use the WMI Win32_PowerManagementEvent to detect a standby event
(and maybe other things as well). Try the script below and see what you get
as result.

Win32_PowerManagementEvent WMI class
http://msdn.microsoft.com/library/e...gementevent.asp

A vbscript example (will loop forever until terminated):

Set colMonitoredEvents = GetObject("winmgmts:")._
ExecNotificationQuery("Select * from Win32_PowerManagementEvent")

Do
Set strLatestEvent = colMonitoredEvents.NextEvent
Select Case strLatestEvent.EventType
Case 4
MsgBox "Entering suspend."
Select Case strLatestEvent.EventType
Case 7
MsgBox "Resuming from suspend."
Case 11
MsgBox "OEM Event happened, OEMEventCode = " _
& strLatestEvent.OEMEventCode
Case 18
MsgBox "Resume Automatic happened"
End Select
Loop

Dean Wells (MVP)

unread,
Jun 17, 2008, 12:23:27 PM6/17/08
to
"Harlan Grove" <hrl...@gmail.com> wrote in message
news:4383036a-1cce-4152...@v1g2000pra.googlegroups.com...


I imagine there are any number of ways to do this, since I use Vista,
I've configured a scheduled task that's triggered by the event that's
logged during resume (see the exported & detailed info. below) -

Log Name: System
Source: Microsoft-Windows-Power-Troubleshooter
Date: 6/17/2008 12:20:06 PM
Event ID: 1
Task Category: None
Level: Information
Keywords:
User: LOCAL SERVICE
Computer: CUBE
Description:
The system has resumed from sleep.

Sleep Time: 6/17/2008 4:18:31 PM
Wake Time: 6/17/2008 4:19:46 PM

Wake Source: Device -ACPI Sleep Button
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-Power-Troubleshooter"
Guid="{cdc05e28-c449-49c6-b9d2-88cf761644df}" />
<EventID>1</EventID>
<Version>0</Version>
<Level>4</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x8000000000000000</Keywords>
<TimeCreated SystemTime="2008-06-17T16:20:06.868Z" />
<EventRecordID>190913</EventRecordID>
<Correlation ActivityID="{0CFCA687-1520-42FE-8B54-462E78B6100C}" />
<Execution ProcessID="1136" ThreadID="2216" />
<Channel>System</Channel>
<Computer>CUBE</Computer>
<Security UserID="S-1-5-19" />
</System>
<EventData>
<Data Name="SleepTime">2008-06-17T16:18:31.328Z</Data>
<Data Name="WakeTime">2008-06-17T16:19:46.983Z</Data>
<Data Name="SleepDuration">14665</Data>
<Data Name="WakeDuration">492</Data>
<Data Name="DriverInitDuration">399</Data>
<Data Name="BiosInitDuration">481</Data>
<Data Name="HiberWriteDuration">23241</Data>
<Data Name="HiberReadDuration">0</Data>
<Data Name="HiberPagesWritten">0</Data>
<Data Name="Attributes">20499</Data>
<Data Name="TargetState">4</Data>
<Data Name="EffectiveState">5</Data>
<Data Name="WakeSourceType">4</Data>
<Data Name="WakeSourceTextLength">17</Data>
<Data Name="WakeSourceText">ACPI Sleep Button</Data>
</EventData>
</Event>

--
Dean Wells [MVP / Directory Services]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l

pudway56

unread,
Jun 17, 2008, 10:06:00 PM6/17/08
to
0 new messages