Critical Battery Action
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 (sincethe 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 USBActually, 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.
July 13th, 2009 12:00am
Hi, Thank you for posting here. Im 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.
Free Windows Admin Tool Kit Click here and download it now
July 13th, 2009 10:15pm
Hi,Thank you for posting here. Im 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...
July 15th, 2009 3:44pm
Hi, Thank you for your reply. I understand you wouldnt 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" didnt 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.
Free Windows Admin Tool Kit Click here and download it now
July 16th, 2009 4:11am
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.
July 16th, 2009 1:52pm
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.
Free Windows Admin Tool Kit Click here and download it now
July 19th, 2009 9:58pm
Hi Mervyn,Is this a registered problem? Could you point me to kb article or notice that it is fixed in R2? Thanks!
September 15th, 2009 3:24am
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 truefor each battery in batteryCollbattery.Refresh_if battery.batteryStatus = 1 and battery.EstimatedChargeRemaining <= 5 thenfor each os in osCollos.Win32Shutdown 5nextend ifnextwscript.Sleep 15000wendHere, 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!
Free Windows Admin Tool Kit Click here and download it now
September 15th, 2009 5:56am
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!
March 29th, 2012 11:40am
I dont think you or Microsoft understand the seriousness of this issue.
This is still very much an issue. Ive found that both Windows 2008 R2 SP1 and Windows 7 SP1 both fail to shutdown properly when running on battery. Ive tried two different APC UPS.
For some reason Microsoft is brushing this off. This isnt a small problem but the Windows platform isnt 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 didnt shutdown correctly. This caused a corrupted SQL database and I had to restore the server.
Im sure there are thousands of small businesses affected by this issue who arent 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
Free Windows Admin Tool Kit Click here and download it now
May 2nd, 2012 1:30pm
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
June 7th, 2012 11:11pm


