Virtual PC Guy's Blog

-- Ben Armstrong, Virtualization Program Manager

Talking about core virtualization at Microsoft (Hyper-V, Virtual PC and Virtual Server).

Welcome to MSDN Blogs Sign in | Join | Help

Setting up Hyper-V with a UPS

People have asked me how you go about setting up a UPS (Uninterruptable Power Supply) with Hyper-V.  This is much easier than it sounds.  The first thing to understand is that when you shut down the physical computer, the virtual machines will be automatically put into a saved state.  Virtual machines that were running when the server shuts down will be started automatically when the physical computer starts back up.

This all means that – for the most part – things “just work” when you connect a UPS and configure the management operating system like you would for a stand alone computer.

Depending on your environment – there are some configuration changes that you may want to make:

  1. Changing the automatic stop action

    As I mentioned, Hyper-V will save state any running virtual machines when the physical computer shuts down.  Depending on how much memory is assigned to the virtual machine, and the software installed inside the virtual machine, you may prefer to have the virtual machine shut down instead.  I have gone with this option on my server at home:

    StopAction

  2. Changing the automatic start action

    Only virtual machines that were running when the system was shut down will be started automatically.  If you are paranoid, like me, you can go in and configure essential virtual machines to always start automatically – even if they were not running when the physical system was shut down:

    StartAction

    You can also configure start up delays, to ensure that more important virtual machines are started first.

  3. Setting aside enough time for system shut down

    This one is critical.  It can take a while for Hyper-V to shutdown as we are trying to save state / shut down a bunch of virtual machines.  For this reason you need to ensure that your system starts shutting down with enough battery life left in order to make it through the whole shut down process.

My personal UPS story:

You would not believe, but living in north Redmond the power quality around here is lousy.  I often get strange power surges / flickers – and have to deal with half a dozen black-outs of one hour or more each year.  Needless to say I have lost a bunch of hardware over the years as a result of this.

A while ago I went out and bought a nice beefy UPS to protect my Hyper-V server and all of my networking gear.  To start with I just hooked up the power and confirmed that I could run for about 30 minutes before running out of power.  I connected the USB monitoring cable, but did not setup any monitoring software, for a couple of reasons:

  1. I got an APC UPS.  I love these guys for their hardware – I hate them for their software.  For that matter, I do not know of any UPS provider where I would be happy to install their monitoring software on my servers.
  2. I am lazy.

Recently, when I was performing some hardware maintenance on in my Hyper-V server I decided to go and have a look in the device manager to see what Windows thought about my UPS.  Much to my surprise I saw that Windows had detected the presence of a UPS battery with no intervention from me:

device manager

Once I noticed this I decided to have a look around – and I discovered that Windows had enabled standard power support – and was acting like my server was essentially a really big clunky laptop.  I had a battery icon in the task bar that accurately reflected the amount of charge in my battery, and when I disconnected power from the UPS – Windows immediately knew about it.

Next I opened the power policy settings and configured my system to get a low battery alert when the battery was at 75% charged, and to shut down when the battery reached 50% charged:

power plan

I have since tested this – and everything works perfectly – all with no need for anything other than the “in-box” capabilities of Windows Server 2008 R2.  Neat!

Cheers,
Ben

Published Thursday, October 22, 2009 12:16 AM by Virtual PC Guy

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Setting up Hyper-V with a UPS

Indeed all the software that comes with UPS devices is more or less lousy. Go figure. Of course I am talking about simple workstation/server UPS devices.

I wonder whether there is a list of UPS devices that are automatically recognized by Windows. For example my Windows 7 doesn't have a clue about my Socomec UPS.

Thursday, October 22, 2009 12:23 AM by Miha Markic

# re: Setting up Hyper-V with a UPS

i've tried a few UPS's and the APC ones seem to be the only ones that work with vista, 2k8 and win7 enabling suspend (unless using hyper-v!) and power saving settings to be controlled natively by windows.  i'd only buy apc in the future because of this.  all my PC's running vista or newer have their settings rolled out by group policy now and there is no need to install APC software anyware!

Thursday, October 22, 2009 1:33 AM by Regs

# re: Setting up Hyper-V with a UPS

Is it really that hard to make UPS windows compliant instead of distributing crap software?

Thursday, October 22, 2009 1:37 AM by Miha Markic

# re: Setting up Hyper-V with a UPS

What model of UPS are you using?

Thursday, October 22, 2009 5:08 AM by Mike

# re: Setting up Hyper-V with a UPS

Socomec NeTYS PE 800VA. They provide Uni Vision software which is $#$#%#"&#!.

http://www.socomec.com/presentation-netys-pe.html

The funny thing is that this isn't really a no-name UPS.

On the good side it is passively cooled - no fans thus no noise.

Thursday, October 22, 2009 5:32 AM by Miha Markic

# re: Setting up Hyper-V with a UPS

the eaton/powerware ups's are a fairly large well known brand too and I had no luck with them.  i'm sure it can't be that hard for these other vendors to create an ACPI compliant UPS interface.

Thursday, October 22, 2009 5:49 AM by Regs

# re: Setting up Hyper-V with a UPS

Another Socomec user here...with the same issue, not to mention there's no way to turn off the alarm permanently. I really don't need to be waken up at night so I can manually turn it off...

Their support was less then helpful in this area as well.

Thursday, October 22, 2009 11:43 AM by Miha Pecnik

# re: Setting up Hyper-V with a UPS

For the record - my UPS is the APC Back-UPS XS 1500.

Cheers,

Ben

Saturday, October 24, 2009 7:09 PM by Virtual PC Guy

# re: Setting up Hyper-V with a UPS

A correction on the saved state.  It is my understanding that the machines will only resume if the option is set to do so on the virtual machine itself.  

Under Virtual Machine Settings --> Automatic Start Action there are 3 options

Nothing

Auto Start if was running when service stopped

Always Start

This setting must be set correctly to get the desired results.  

Tuesday, October 27, 2009 8:30 PM by Tracy Sells

# re: Setting up Hyper-V with a UPS

Hi, You need to aware with some issues with the built-in Windows support for USB connected UPS-s especially on servers. Some APC models and almost all of Eaton ones behave normally during shutdown, but the UPS does not restart when power is restored (You have to manually start the UPS).

Wednesday, October 28, 2009 12:20 AM by Toma Bussarov

# re: Setting up Hyper-V with a UPS

Tracy Sells -

Correct, but "Auto Start if was running when service stopped" is the default setting for virtual machines.

Toma Bussarov -

Interesting, I will have to look into this.

Cheers,

Ben

Wednesday, October 28, 2009 11:44 AM by Virtual PC Guy

# re: Setting up Hyper-V with a UPS

Hey Ben, your article inspired me to get one of those APC UPS's. I waqs a bit disappointed that the added software only shuts down one system, rather than any number you want.

Since you mentioned W2K8 now 'sees' the UPS, I used WMI in a VBScript to poll the UPS, and shut down any number of machines I want!

http://www.servercare.nl/Lists/Posts/Post.aspx?ID=91

Wednesday, November 18, 2009 11:25 AM by Paul Weterings

# re: Setting up Hyper-V with a UPS

It is very nice. But what about the core edition or the Hyper-V server edition and UPC connection?

Thursday, November 26, 2009 3:22 AM by Zoltán

# re: Setting up Hyper-V with a UPS

That's also what I would like to know: How can an UPS be handled with Hyper-V R2 Server edition (Core) ?

Monday, November 30, 2009 5:13 AM by itsame

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker