This article is a work-in-progress. Please feel free to correct and extend it.

This article is not specific to running the Hyper-V as a role within Windows Server 2008 on a laptop; this is described here, How To run Hyper-V on a laptop.
This article is designed for non-IT professional who wants to run Hyper-V on a single machine (laptop, workstation, etc.) and remotely administer it.  The docu
mentation on TechNet and MSDN focusses on enterprise IT use, on a server. It is quite possible that you may wish to use Hyper-V Server 2008 R2 on a laptop computer; for training, mobile use or just for fun.



Key barriers to using Hyper-V Server 2008 R2 standalone

There are some key issues with running Hyper-V Server on a laptop that need to be solved for standalone use without a secondary machine being required for day to day management of the running virtual machines.

  • Workgroup configuration for remote management
  • Local management of virtual machines without using Hyper-V Manager
  • Configuration power schemes from the command line
  • Remote desktop connection client for viewing local virtual machines from the console

Workgroup configuration

It is highly likely that in the scenarios where you are using a laptop to run Hyper-V Server, you won't be placing that machine on a domain and will use it in workgroup mode. Connecting to a Hyper-V Server running on a workgroup requires careful setting of various security permissions, configuration of the local firewall and DCOM permissions.  Fortunately John Howard has create an excellent Hyper-V Remote Management Configuration Utility which simplifies the process of opening up a Hyper-V Server on workgroup.  The HVRemote script is designed to be run on both the Hyper-V server and any client which wishes to connect to the Hyper-V Server.

Password expiry on local administrator accounts

When you use the Add Local Administrator option on the Hyper-V Server management menu, it will have a standard password expiry policy of 30 days.  Although more secure, you may want to set the account to not expire the password by using the following command at the command prompt window.

wmic path Win32_UserAccount where Name='testusername' set PasswordExpires=false

As the local administrator is often the same login used for remote desktop connections or for remote management using the Hyper-V Management tool, it is useful in workgroups to not have default expiry policies so that passwords can be synchronised.

Local management - automation with PowerShell library for Hyper-V

The default local management menu under Hyper-V Server 2008 R2 is designed to provide initial configuration to allow the server to be managed from an external client running Hyper-V Manager. 

To locally start/stop virtual machines, modify configurations and manipulate VHD images, there is a PowerShell library provided by James O'Neill that is available on CodePlex as the PowerShell Management Library for Hyper-V. This includes comprehensive documentation in PDF format which greatly reduces the learning curve of what is in the library and demonstrates what you can achieve.

As the library is based on PowerShell 2.0, you will need to install the PowerShell library for Hyper-V Server 2008 R2. This is not installed as standard.

start /w ocsetup NetFx2-ServerCore

start /w ocsetup MicrosoftsoftWindowsPowerShell

To test that the installation was successful you can run PowerShell from the command window.  You can confirm that the installation is version 2 of PowerShell by starting PowerShell with the option to force 2.0 compatibility, powershell -version 2.0

Power configuration

Similar to running Hyper-V on a laptop as a role under Windows Server 2008, there are issues regarding power options.  However, as there is no control panel utility to manage power settings under Hyper-V Server 2008 R2, the command line utility powercfg must be used to configure the power options.

C:\>powercfg -list

Existing Power Schemes (* Active)
-----------------------------------
Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e  (Balanced) *
Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c  (High performance)
Power Scheme GUID: a1841308-3541-4fab-bc81-f71556f20b4a  (Power saver)

C:\>powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c

C:\>powercfg -list

Existing Power Schemes (* Active)
-----------------------------------
Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e  (Balanced)
Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c  (High performance) *
Power Scheme GUID: a1841308-3541-4fab-bc81-f71556f20b4a  (Power saver)

C:\>

A default installation on a Hyper-V Server 2008 R2 will automatically select the Balanced power option which is not really compatible with the Hyper-V role, as it reduces performance and can even cause the machine to enter Standby mode if not used for some time.  The first step is to list the various power configurations available, and then set the active power configuration to High Performance by selecting the correct scheme GUID with the powercfg -setactive switch.

Remote desktop connection

The final step to full local management of virtual machines running under Hyper-V Server 2008 R2 would be a remote desktop client which can be used once the virtual machine has been configured to accept remote desktop connections via Hyper-V Manager. This is not installed by default on Hyper-V Server 2008 R2, however, if you have access to a Windows Server 2008 R2 installation you can copy the following files to your Hyper-V Server 2008 R2 (based on the US English file layout, en-US). Run mstsc.exe from the command prompt on the Hyper-V Server 2008 R2 console to connect to remote systems, including local virtual machines.

\Windows\System32\mstsc.exe
\Windows\System32\mstscax.dll
\Windows\System32\msacm32.dll
\Windows\System32\en-US\mstsc.exe.mui
\Windows\System32\en-US\mstscax.dll.mui

Remote desktop is not possible to virtual machines configured with either no network connection or a private virtual network connection. However, using a remote desktop client on the Hyper-V Server 2008 R2 console supports connecting to virtual machines that are configured to run on internal virtual network connections as well as external network connections. This allows a more restrictive, and more secure, internal virtual network to be created to contain your virtual machines, yet still enable remote desktop connections.