This post isn’t directly related to Operations Manager, but I thought it might be useful to those running lab environments and looking for ways to optimize their hardware resources.  Windows 2008 Core is one way to reduce the footprint of the OS hosting your virtualized servers.  When I decided to move my VM’s to Hyper-V hosted on Windows 2008 Core, I went through some pains which led me to create this document outlining these procedures for later use.  This should save you some time and effort when you decide to go ’hardcore’.

This walk-through assumes a clean installation of Windows Server 2008 Core, with no roles yet installed.

Note: Text throughout this document that has a red font indicates a variable you need to provide.

Ensure your hardware supports Hyper-V

First ensure the latest BIOS have been installed.

Boot into BIOS and enable “Hardware Assisted Virtualization” and “Hardware Enforced DEP”.  Verbiage may not be exactly as quoted here, depending on your hardware, but should look similar.

If these settings are not found in BIOS, Hyper-V is not supported on that system. This is usually because either the processor is not capable of supporting Hyper-V or the Mainboard cannot support Hyper-V.

Check for required hotfix to support Hyper-V

WMIC QFE List should reveal KB950050. If not, download and install.

Note: Windows Server 2008 with Service Pack 2 includes this hotfix.  KB950050 is not listed if SP2 is installed.

Example: KB950050 is not listed.  KB955430 indicates SP2 is installed.
image

Set Time Zone

Control TimeDate.cpl

Example: Control TimeDate.cpl
image

Note: Regional settings are configurable during installation. If this needs to be changed after installation for some reason, the Date Time applet can be launched using this command.

Rename Computer

NETDOM RenameComputer %ComputerName% /NewName:ComputerName

Note: It’s not necessary to restart until after you have joined the computer to the domain in a later step.

Configure Network Interfaces

NETSH Int IPv4 Show Int

Note the “Idx” of the interface which you’ll be updating.  This is any network interface that is connected to the LAN.

Example:  Output displays which interface to note.
clip_image002

NETSH Int IPv4 Set Address Name=”5” Source=Static Address=xxx.xxx.xxx.xxx Mask=xxx.xxx.xxx.xxx Gateway=xxx.xxx.xxx.xxx

NETSH Int IPv4 Add DNSServer Name=”5” Address=xxx.xxx.xxx.xxx Index=1

NETSH Int IPv4 Add DNSServer Name=”5” Address=xxx.xxx.xxx.xxx Index=2

Note: Index is the DNS search order.  It is not necessary to configure more than one DNS server.

Product Key Activation

I added product key activation steps, but you may skip this section if you’ve already activated or do not wish to activate now.

Install the product key:
SLMGR /ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx

Activate the product key:
SLMGR /ato

Join to domain

It is not required for the server hosting the Hyper-V Role to be a member of a domain. Having the client running the Hyper-V Manager tool in the same domain as the server running the Hyper-V Role reduce some configuration options, but workgroup or otherwise disjoined servers will work as well. If you do not wish to join the Hyper-V server to a domain, you may skip this step.

NETDOM Join %computername% /Domain:domain /Userd:username /Passwordd:* /SecurePasswordPrompt /REBoot:seconds

Install and Start Hyper-V

Set Hyper-V to auto-start:
BCDEDIT /Set HyperVisorLaunchType Auto

Install Hyper-V Role:
Start /w OCSetup Microsoft-Hyper-V

Configuring Hyper-V

Download and install the Hyper-V Management Tool.

Vista download (requires Vista SP1+): http://support.microsoft.com/kb/952627

Download the HVRemote tool (http://code.msdn.microsoft.com/HVRemote). Unpack the VBScript (HVRemote.wsf) to a location accessible by the server hosting the Hyper-V Role and the workstation you will be using to run Hyper-V Manager. Alternatively, copy it to a location on the local machine(s).

On the server hosting the Hyper-V Role

HVRemote.wsf /add:domain\user

Note: If this is not a domain joined machine, just add the local administrator account or another account of your choosing as follows.

HVRemote.wsf /add:computername\Administrator

On the client that will be used to manage Hyper-V (running Hyper-V Manager)

HVRemote /mmc:enable

Connect to Hyper-V host

Open Hyper-V Manager on the client, right-click on the top node “Hyper-V Manager”, and select Connect to Server…

 

Additional configuration steps

If your Hyper-V host and the client running the Hyper-V Manager are not in the same domain, there may be additional configuration steps required to connect to the host.

If you’re unable to connect to Hyper-V host in previous step, try these additional configuration steps in the order listed, and attempt to connect to Hyper-V host in Hyper-V Manager after completing each step.

First try

If the client running Hyper-V Manager and the server hosting the Hyper-V Role are not in the same domain, or are running workgroup mode, you may need to add the server credentials to Local clients CredSSP store.

cmdkey /add:hyper-v_hostname /user:hyper-v_hostname\user /pass:password

Second try

Open REGEDIT and navigate to the following key:

HKLM\SYSTEM\CurrentControlSet\Control\Lsa\Credssp\PolicyDefault

If you do not see a key hierarchy as follows…
clip_image004

…save the registry editor text below to a *.reg file and import these keys.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\Credssp\PolicyDefaults]

"DebugLogLevel"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\Credssp\PolicyDefaults\AllowDefaultCredentials]

"Hyper-V"="Microsoft Virtual Console Service/*"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\Credssp\PolicyDefaults\AllowDefaultCredentialsDomain]

"Hyper-V"="Microsoft Virtual Console Service/*"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\Credssp\PolicyDefaults\AllowFreshCredentials]

"Hyper-V"="Microsoft Virtual Console Service/*"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\Credssp\PolicyDefaults\AllowFreshCredentialsDomain]

"Hyper-V"="Microsoft Virtual Console Service/*"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\Credssp\PolicyDefaults\AllowFreshCredentialsWhenNTLMOnly]

"Hyper-V"="Microsoft Virtual Console Service/*"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\Credssp\PolicyDefaults\AllowFreshCredentialsWhenNTLMOnlyDomain]

"Hyper-V"="Microsoft Virtual Console Service/*"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\Credssp\PolicyDefaults\AllowSavedCredentials]

"Hyper-V"="Microsoft Virtual Console Service/*"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\Credssp\PolicyDefaults\AllowSavedCredentialsDomain]

"Hyper-V"="Microsoft Virtual Console Service/*"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\Credssp\PolicyDefaults\AllowSavedCredentialsWhenNTLMOnly]

"Hyper-V"="Microsoft Virtual Console Service/*"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\Credssp\PolicyDefaults\PolicyDefaults]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\Credssp\PolicyDefaults\PolicyDefaults\AllowDefaultCredentials]

"Hyper-V"="Microsoft Virtual Console Service/*"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\Credssp\PolicyDefaults\PolicyDefaults\AllowDefaultCredentialsDomain]

"Hyper-V"="Microsoft Virtual Console Service/*"

Third try

In most cases, the previous steps should allow you to connect to the Hyper-V host. In some cases, anonymous access to DCOM may need been to be explicitly granted. This can be accomplished with the HVRemote program as follows.

HVRemote /AnonDCOM:grant

 

Windows Server 2003 Virtual Machines in Hyper-V

Network Adapter Caveat

Windows Server 2003 requires SP2 in order to install the Hyper-V Integration Services.

1.  Create ISO of SP2 and “Insert Disk” for installation. Apply Service Pack 2 to any virtual machines running Windows Server 2003.

2.  After SP2 has been applied, “Insert Integration Services Disk” and the Network Adapter drivers will be detected.