Using a USB connected APC UPS with Windows Server 2008 and VMware Server 2.0
Posted by jpluimers on 2010/06/24
Recently I took over some system management at a client.
They run Windows 2008 Server x64 and a Windows Server 2008 VM under VMware Server 2.0 and a LAN with some client machines
A lot of things were not covered, backup, power outage, etc, so I’m implementing those step by step.
They now have an APC UPS connected through USB.
There are a lot of references on the internet about the APC software (well, more like UPS vendor supplied software in general) being crap.
Luckily, Windows Server 2008 (and 2003) have built-in support for APC UPSes.
Furthermore when Windows Server shuts down, VMware Server needs to perform some actions on the guests as well.
This post covers the configuration of both :-)
Basically, Windows recognizes the APC UPS as a UPS battery (so it appears like your server is a laptop with a huge battery <g>).
So configuring is pretty straightforward: it is about finding where the configuration settings.
I didn’t find out all of this myself, Virtual PC Guy has a good starting point on setting up Hyper-VSetting up Hyper-V with a UPS .
He uses Windows Server 2008 R2 (the client uses the non-R2), and Hyper-V (the client uses VMware), so there are a couple of differences.
Configuration of USB connected APC UPS on Windows Server
First a warning:
There is a bug in Windows Server 2008: Shutdown does not work properly.
The suggested solution is to hibernate or sleep instead.
Sleep is not a good idea when running on batteries.
But hibernate works fine with batteries.
I’m not not sure if this bug is on a few or all systems involved, but you have been warned :-)
Configuring the UPS
First we are going to make sure that the UPS can wake up the PC (for instance, when power comes back up, or when the PC is asleep and the UPS loses power).
Note that not all PC’s
- Run the device manager (devmgmt.msc)
- In the “View” menu, select “Devices by connection”
- Browse for USB devices that look like this:
- Go to the last tab, and make sure that the “Allow this device to wake the computer” is checked:
Press OK to close this dialog.
Then we are going to make sure the power plan works around the bug described above.
- In the control panel, go to power stetings
(or run “powercfg.cpl” to get there in one step) - Choose a plan, then click on the “change plan settings” for that plan:
- Now you are in the “Edit plan settings” dialog.
Here you click “change advanced power settings” here:
- This “Power Options” is for editing the “Advanced settings”.
(the direct command to run to get this dialog is this: “C:\Windows\system32\rundll32.exe” shell32.dll,Control_RunDLL PowerCfg.cpl @0,/editplan:8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
)
Make sure that the “Critical battery action” for “On battery” is “Hibernate”
(see the above bug why)
Make sure your the “Critical battery level” for “On battery” is large enough so your system can in fact hibernate
Press “OK” or “Apply” when you made changes.
Testing the “Critical battery action”
The easiest way to test the “Critical battery action” is to pull the mains plug from the UPS, then let the PC drain the UPS.
To speed up the process, you need to make your PC use as much power as possible and/or temporarily increase the “On battery” percentage a lot.
Mark Allen has a nice http://www.playtool.com/pages/prime95/prime95.html which you can use for the former.
Note that the current implementation for Prime95 uses multiple cores, so you probably don’t need to run multiple instances of it any more.
Configuring VMware server to perform shutdown actions
Further reading
If you run VMware server, you need to configure it so it properly shuts down the guest VMs when the server itself shuts down.
Of course this is needed when you have chosen above to let the “Critical battery action” shutdown your server (only recommended if you are using Windows Server 2008 R2!).
But in general this is a good idea anyway, as you might manually want to shutdown or restart your host once in a while (Windows Updates anyone?).
Configuring VMware server 2.0 is easy.
Just make sure your configuration matches the screen shot below.
If you need to change the settings, click the “Properties” link (which contrary to most UI things is on the right side of the window).
Shutting down multiple servers
I’ve not done this yet, but if you have a bigger APC UPS, you might want to have it control multiple servers.
Some APC UPS systems can connect by both USB or serial.
But those are mutually exclusive: you can only use one at a time.
APC has a AP9207 SHARE-UPS product for this, but it only works for serial communication.
Another alternative is to use one of the APC Network Management Interface Cards.
Finally there are some software-only solutions, I found a few and listed them below.
I have not tried them yet, so they are on my list for future experimentation:
- apcupsd cross platform APC UPS daemon to shutdown multiple machines
- UPSWatcher Windows script to monitor a UPS and shutdown multiple Windows machines upon power outage
- How To Use One UPS on Multiple Computers
Lot’s of things on the todo list :-)
References:
- Setting up Hyper-V with a UPS – Virtual PC Guy’s WebLog – Site Home – MSDN Blogs.
- Torture test your CPU with Prime95; download prime95 here
- apcupsd cross platform APC UPS daemon to shutdown multiple machines
- UPSWatcher Windows script to monitor a UPS and shutdown multiple Windows machines upon power outage
- How To Use One UPS on Multiple Computers
amr42 said
Can anyone here help me with configuring Windows 2003 with an APC UPS. Both the low and critical battery limits refuse to be set to anything except 100% – so alarm triggers as soon as power is removed from UPS. Any ideas?
jpluimers said
I’ve no idea; Windows 2003 is too long ago for me. Sorry.
Claus said
Be carefull to connect UPS to a USB2 connector under Win2012 – connecting to USB3 will never display battery in Device Manager.
jpluimers said
Thanks!
–jeroen
Darryl C said
I cannot see the power management tab on the HID UPS Battery property page… What do I do to make this appear?
jpluimers said
I never had that happen. I’d start searching with https://www.google.com/search?q=“power+management”+tab+invisible
Two posts that might be interesting:
– Are you an administrator on that machine (non-admins probably won’t see that tab) http://answers.microsoft.com/en-us/windows/forum/windows_7-hardware/no-power-management-tab-in-anything-but-touchpad/23b15f1d-d26a-4bff-b392-75f1288af220
– Is your machine part of a large organization (where group policy settings might have disabled the power management) http://windows.microsoft.com/en-us/windows-vista/troubleshoot-power-problems
Stefano said
Hi I was just reading your post as we have Win 2008 servers and UPS backups and we are trying to implement e-mail alerts for conditions such as battery capacity, power failures and battery load. Can these be configured to send out e-mail alerts to a specific address much like Powerchute does? Thanks
jpluimers said
I haven’t tried that yet, so I don’t know.
Keep me posted when you find out!
–jeroen