Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsWindows Server 2003Windows 2000Windows NTSmall Business ServerVirtual ServerExchange ServerIISHost Integration ServerISA ServerSMSWSUSMOMWindows Media ServerSecurityCertification
Related Topics
SQL ServerMS WindowsMS OfficePC HardwareMore Topics ...

Windows Server Forum / Windows 2000 / Command Prompt / June 2008

Tip: Looking for answers? Try searching our database.

Detect Restart from Hybernate or Stand By

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Harlan Grove - 17 Jun 2008 03:44 GMT
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 - 17 Jun 2008 05:38 GMT
> Is there a way to detect restarting from hybernate or stand by states
> that I could use to run batch files?
[quoted text clipped - 6 lines]
> 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
Dean Wells (MVP) - 17 Jun 2008 17:23 GMT
> Is there a way to detect restarting from hybernate or stand by states
> that I could use to run batch files?
[quoted text clipped - 6 lines]
> 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>

Signature

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 - 18 Jun 2008 03:06 GMT
> > Is there a way to detect restarting from hybernate or stand by states
> > that I could use to run batch files?
[quoted text clipped - 64 lines]
>   </EventData>
> </Event>
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.