PC Review


Reply
Thread Tools Rate Thread

Detect Restart from Hybernate or Stand By

 
 
Harlan Grove
Guest
Posts: n/a
 
      17th Jun 2008
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.
 
Reply With Quote
 
 
 
 
billious
Guest
Posts: n/a
 
      17th Jun 2008

"Harlan Grove" <(E-Mail Removed)> wrote in message
news:4383036a-1cce-4152-8a36-(E-Mail Removed)...
> 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.


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



 
Reply With Quote
 
Dean Wells \(MVP\)
Guest
Posts: n/a
 
      17th Jun 2008
"Harlan Grove" <(E-Mail Removed)> wrote in message
news:4383036a-1cce-4152-8a36-(E-Mail Removed)...
> 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.



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



 
Reply With Quote
 
pudway56
Guest
Posts: n/a
 
      18th Jun 2008


"Dean Wells (MVP)" wrote:

> "Harlan Grove" <(E-Mail Removed)> wrote in message
> news:4383036a-1cce-4152-8a36-(E-Mail Removed)...
> > 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.

>
>
> 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
>
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Computer Restart after resuming of Stand By =?Utf-8?B?TWFya28=?= Windows XP Help 3 19th Nov 2009 10:01 PM
Several Stand-by & Restart nuisances to resolve. Teflon Windows XP Basics 3 8th Apr 2007 05:12 AM
Stand-by / Hybernate Beginner Windows XP General 4 9th Feb 2004 08:29 PM
Stand By - Turn Off - ReStart Jeff Windows XP General 2 3rd Nov 2003 07:53 PM
No sound after stand-by restart Brett Windows XP General 0 4th Sep 2003 03:04 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:39 AM.