Search

Thursday, March 18, 2010

Hibernate and Sleep with Windows Server 2008 R2 Hyper-V

I just received my new laptop last few weeks with installed Windows Server 2008 R2 64bit .

I have found that as soon as we install the hyper-v role hibernate and sleep are disabled. This is because the once hyper-v service is enabled, it disables the support for hibernate and sleep.


While there is no way to enable the hibernate or sleep feature while the hyper-v service is running, you can control when the service is started by changing Start parameter of the hvboot service :

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\hvboot]
 
The Start property of a service can have the following values:
  • 0=Boot
  • 1=System
  • 2=Auto
  • 3=Demand
  • 4=Disabled
Set the value to 3, so that you can start the service when you want. 0 is not supported for hvboot.

Reboot the server. Hibernate and sleep should now be enabled for you till the time you start the hvboot service.

However, now if you try to start a virtual server in the hyper-v console you will get an error saying that the hyper-v service is not running and you will have to start it manually using the net start command. To do this, start command prompt under administrator privileges and execute the following command to start the service.

net start hvboot

Now you should be able to start your virtual machines. However, as a side effect hibernate and sleep will be disabled till you restart you machine.

Tweaking with the registry can be dangerous so for those who want a safe alternative, you can use the following command to set the Start property of the hvboot service as well:

sc config hvboot start= demand

The other values that you can use are system, auto, demand and disabled. Boot is not supported.

Note:
  1. Space between = and demand. The syntax of service config requires this space.