locked
Critical Battery Action RRS feed

  • Question

  • I'm toying with the built in UPS support in Server 2008 (basically like having a laptop with battery), and did a test, when the critical battery level was reached, the shutdown was almost instant.  Normally my server takes 3 minutes or so to shut down, but this was like desktop, mouse switched to hourgass, and then server powered off, no shutdown screens or anything.  Upon reboot I was asked for a reason for the unexpected shutdown so it doesn't appear to have been graceful in any way.  I have a RAID card with write cache enabled and no battery (since the PC is UPS protected), and it didn't complain of lost data upon reboot as it normally would, but that may have just been lucky, the shutdown was at like 2am and it very well could have been mostly idle.

    Is this some "critical rapid shutdown" feature or a bug?  I really want graceful shutdown, or at the very least to have it signal the raid card to commit unwritten data, which it may have done here, but no way to be sure.

    Server 2008 x64 Enterprise.
    APC UPS via USB

    Actually, looking in the detailed logs for my RAID card, it does appear that the OS signaled it that it was shutting down.  So I guess this must be some sort of fast shutdown, but I can't imagine it is managing to gracefully shutdown Exchange 2007 and everything else in a matter of a few seconds, but maybe it commits important database stuff then signals immediate stop of services or something.

    Also, I'm wondering if there is any way to enable any sort of logging for battery/power events?  Switched to battery, switched to AC Power, shutting down, etc.  Noting shows in event log now that I can see, figure there may be some debugging/higher logging level available somewhere.
    Monday, July 13, 2009 4:00 AM

Answers

  • Hi,

    Thank you for your reply. I understand you wouldn’t like to enable hibernation instead.

    If you would like to, you may refer to the "Sleep" section of the article below to enable Sleep.
    http://support.microsoft.com/kb/947036

    There is no report that "low battery action" didn’t operate correctly; you can test it. Also, this problem has been fixed in Windows Server 2008 R2.

    Thanks.

    This posting is provided "AS IS" with no warranties, and confers no rights.
    • Marked as answer by Mervyn Zhang Tuesday, July 21, 2009 11:30 AM
    Thursday, July 16, 2009 8:11 AM

All replies

  • Hi,

    Thank you for posting here.

    I’m afraid this is a known issue with Vista/Windows Server 2008. If you set Critical Battery Action to Shut Down, it will not work properly to shut down system. Error 6008 was recorded in Event log.

    Product Team has investigated this issue. But solution is not available currently due to the complexity of involved system components. This should be fixed in Windows 7/Windows Server 2008 R2. Sorry for the inconvenience this has brought.

    I suggest you change the Critical Battery Action to Sleep or Hibernate to avoid unexpected shut down.

    Thanks.

    This posting is provided "AS IS" with no warranties, and confers no rights.
    Tuesday, July 14, 2009 2:15 AM
  • Hi,

    Thank you for posting here.

    I’m afraid this is a known issue with Vista/Windows Server 2008. If you set Critical Battery Action to Shut Down, it will not work properly to shut down system. Error 6008 was recorded in Event log.

    Product Team has investigated this issue. But solution is not available currently due to the complexity of involved system components. This should be fixed in Windows 7/Windows Server 2008 R2. Sorry for the inconvenience this has brought.

    I suggest you change the Critical Battery Action to Sleep or Hibernate to avoid unexpected shut down.

    Thanks.

    This posting is provided "AS IS" with no warranties, and confers no rights.

    My server 2008 doesn't list sleep or hibernate as options.  I know there is a hidden way to enable hibernate support but honestly I'd prefer it just shutdown cleanly, as I don't believe either sleep or hybernate would gracefully shut down they hyper-V VMs?  I'm not sure if sleep should be there or not, I'd kind of suspect not on a server OS?  Using the APC software for the UPS had the same symptom on shutdown I believe so it must use the same mechanism to shut down.

    Would using the "low battery action" make any difference?  Probably not.  I guess I need to find some 3rd party program to run a script upon low battery or something....

    That's a pretty big bug since many people use UPSs on their servers?  I sure hope pricing for R2 reflects the fact that it fixes bugs that won't be fixed in 2008...
    Wednesday, July 15, 2009 7:44 PM
  • Hi,

    Thank you for your reply. I understand you wouldn’t like to enable hibernation instead.

    If you would like to, you may refer to the "Sleep" section of the article below to enable Sleep.
    http://support.microsoft.com/kb/947036

    There is no report that "low battery action" didn’t operate correctly; you can test it. Also, this problem has been fixed in Windows Server 2008 R2.

    Thanks.

    This posting is provided "AS IS" with no warranties, and confers no rights.
    • Marked as answer by Mervyn Zhang Tuesday, July 21, 2009 11:30 AM
    Thursday, July 16, 2009 8:11 AM
  • I think with "Sleep" it is still bad if power is lost so that probably won't help.  I'll try the low battery action as "shut down" and see if that works, would seem odd that that works but not the critical one?  We'll see.
    Thursday, July 16, 2009 5:52 PM
  • Hi,

    Thank you for update. If there is anything else we can do for you, please let us know.

    Thanks.

    This posting is provided "AS IS" with no warranties, and confers no rights.
    Monday, July 20, 2009 1:58 AM
  • Hi Mervyn,

    Is this a registered problem? Could you point me to kb article or notice that it is fixed in R2? Thanks!

    Tuesday, September 15, 2009 7:24 AM
  • I use the following VBS script to gracefully shutdown W2008 when battery level goes beyond threshold:

    set wmi = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}!\\.\root\cimv2")
    set batteryColl = wmi.ExecQuery("select * from Win32_Battery")
    set osColl = wmi.ExecQuery("select * from Win32_OperatingSystem")

    while true
     for each battery in batteryColl
      battery.Refresh_
      if battery.batteryStatus = 1 and battery.EstimatedChargeRemaining <= 5 then
       for each os in osColl
        os.Win32Shutdown 5
       next
      end if
     next
     wscript.Sleep 15000
    wend


    Here, batteryStatus = 1 is 'Discharging' and EstimatedChargeRemaining is the charge level to check.

    Systemwide critical level should be set even lower so there is time to shutdown gracefully before it triggers.

    You should have SE_SHUTDOWN_NAME privilege (you likely do on a laptop).

    Add the script to Startup menu folder or schedule a task.

    Enjoy!

    • Proposed as answer by RWDoyle Tuesday, November 3, 2009 3:25 AM
    Tuesday, September 15, 2009 9:56 AM
  • It doesn't look like this has been fixed in Server 2008 R2.

    I'm running Server 2008 R2 Standard, 64-bit.  When either the Critical Battery Action or Low Battery Action are set to 'Shut Down' and the UPS reaches the specified battery level, the server begins to shut down normally it appears (for instance, I get logged off and see the 'Logging Off' message), but then about 5 seconds later the server simply turns off.

    @aleck.n: Your script works beautifully.  I sucessfully tested it on my server which is also running the Hyper-V role and the attached VMs were shut down gracefully as well.  Thanks!

    Thursday, March 29, 2012 3:40 PM
  • I don’t think you or Microsoft understand the seriousness of this issue.

    This is still very much an issue. I’ve found that both Windows 2008 R2 SP1 and Windows 7 SP1 both fail to shutdown properly when running on battery. I’ve tried two different APC UPS.  

    For some reason Microsoft is brushing this off. This isn’t a small problem but the Windows platform isn’t working as expected or advertised when connected to a UPS. This is very risky as all the settings appear to be correct to gracefully shutdown, within Windows. However when power is lost the system just blips off without a graceful shutdown.

    Yesterday I had a corrupted VM as a server didn’t shutdown correctly. This caused a corrupted SQL database and I had to restore the server.  I’m sure there are thousands of small businesses affected by this issue who aren’t aware that the UPS they are relying on simply will fail because of a bug in Windows

    I sincerely hope Microsoft will actively pursue a fix to this bug.

    Sincerely,
    Matthew Shrewsbury

    Wednesday, May 2, 2012 5:30 PM
  • Matthew is absoutely correct.  I could not agree more.  I've wasted days trying to get either the UPS software or Windows Power Manager to execute a clean shutdown after a power failure.  If nothing else, I'd like to have the critical battery level trigger execute the "shutdown /p" command.

    Can anybody help me with that?

    Sincerely

    Jack

    Friday, June 8, 2012 3:10 AM
  • Same here. We set the server to Shut Down on Critical Battery, only to find (after a power outage) that it went to sleep intead and that the setting was back to Hibernate - which doesn't work, for the reasons above. Hibernate is not listed as an available option on the menu, but it is the current selection. I found that if I set it to Shut Down, it looks right when I reopen the panel - until I log off and back on.

    I set both Low Battery and Critical Battery to Shut Down, and it seems to have kept the setting.

    Monday, October 29, 2012 9:01 PM
  • This issue still exists in Windows Server 2012R2 Standard and Essentials.  When Critical Battery Action or Low Battery Action are set to shutdown the shutdown process is almost instantaneous  (3-5 seconds).  This type of shutdown is incorrect and does not allow programs or VMs to shut down in an orderly fashion and this potentially causes data corruption and/or corruption of Guest VMs.

    I have had to restore a server recently because of Active Directory corruption caused by this issue.

    This is a very serious matter, and Microsoft has "Epic Failed" in resolving this problem.  

    Microsoft, please wake up and solve this.   You already have the mechanism in place.  You just need to change the shutdown method employed by this process to perform an orderly and normal shutdown of the server instead of the almost instantaneous shutdown that the current process invokes.

    Setting the server to hibernate or sleep instead of shutdown is not a solution.  These are Network Servers, some are AD controllers, some have the Hyper-V role installed with VM's running.  Sleep or Hibernation is of course not a possibility for these systems. 

    PLEASE FIX THIS !!!

    Friday, December 12, 2014 5:36 PM
  • I too was quite surprised to find this glaring bug still present in 2012R2. I know being a very large multinational that fixing things can take some time since there are many steps involved in UAT, testing, etc. but it has been over 5 years and two new release of the Windows Server line and the bug is still present. I can only conclude that they just have no interest in fixing it. What is worse is the lack of acknowledgment of the bug. Oh well, VMware is still light years ahead of MS for virtualization so I guess this just goes on the long list of reasons to stick with VSphere.

    David

    Tuesday, January 20, 2015 6:42 PM
  • Hi,

    Thank you for your reply. I understand you wouldn’t like to enable hibernation instead.

    If you would like to, you may refer to the "Sleep" section of the article below to enable Sleep.
    http://support.microsoft.com/kb/947036

    There is no report that "low battery action" didn’t operate correctly; you can test it. Also, this problem has been fixed in Windows Server 2008 R2.

    Thanks.

    This posting is provided "AS IS" with no warranties, and confers no rights.
    Who marked this as the answer?  It's not the answer.
    Saturday, October 1, 2016 7:14 PM