hyper-v

Identify NICs in Windows Server 8 Hyper-V

 

In a Hyper-V cluster are normally a lot of NICs involved. Identifying the right can be challenging. It is important to consequently label your network adapters on all the servers in the Hyper-V cluster.

In Windows Server 8 there are PowerShell Cmdlets that can be used for identifying NICs.  Once you identified the NIC, rename it to meaningful name.   The PowerShell Cmdlets listed below can be executed on the following versions:

- Hyper-V Server 8

- Windows Server 8 Core

- Windows Server 8 GUI

 

Three ways are listed using PowerShell to identify the NIC in a Windows Server 8 Hyper-V environment.

 

Before you begin

Execute PowerShell and import the Hyper-V module using the following command:

Import-Module Hyper-V

1. Identify the NIC by connection State

Connect one NIC and use the following command:

Get-NetAdapter | Select Name, InterfaceDescription, MediaConnectionState | FL

Look at which NIC is connected and rename the NIC to a meaningful name (listed below)

image

Add the second NIC and execute the command again and rename the name of the NIC. Do this for all NICs

 

2. Identify the NIC using the MAC address

When you know the MAC address of the NIC (for example in a HP Flex-10 environment) it can be identified using the following command:

Get-NetAdapter | Select Name, InterfaceDescription, MacAddress | FL

image

Look at the corresponding MAC address  and rename the NIC to a meaningful name (listed below). Do this for all NICs.

 

3. Identify the NIC by PCI bus ID

The last option is to identify the NIC by PCI bus ID. The following command list all NICs PCI bus adapter information:

Get-NetAdapterHardwareInfo | select Name, InterfaceDescription, DeviceType, 
Busnumber, Devicenumber, Functionnumber | FL

image

Look at the corresponding PCI bus and rename the NIC to a meaningful name (listed below). Do this for all NICs.

Rename the NIC

Rename the NIC to a meaningful name, for example, rename the name “Wired Ethernet Connection 2” to “MGMT-LOM01-VLAN20” use the following command:

Rename-NetAdapter “Wired Ethernet Connection 2” –NewName “MGMT-LOM01-VLAN20”

 

Enable Windows Server 8 Hyper-V in VMware Workstation

VMware Workstation Technology Preview 2012 is available as download.  The Technology Preview makes it possible for example to install and operate Windows 8 and Windows Server 8 in a VM and the possibility to nest VMs.

I tested the installation of  Windows Server 8 in VMware Workstation TP, enabled the Hyper-V role and run a Windows 7 64-bit VM in Hyper-V. Here are some screenshots (Hyper-V manager and the Windows 7 64  bit running in Hyper-V): 

image

image

 

To make the above configuration work, add to following options to the end of the VMX file before starting the Windows Server 8 installation:

hypervisor.cpuid.v0 = FALSE
mce.enable = "TRUE"

The VMware Workstation TP VMs are started in debug mode which impacts the performance!  

image

 

More information can be found here:

- VMware Workstation Technology Preview 2012 Overview

- Download

 

Windows Server 8 PowerShell Cmdlets for Hyper-V help

In Windows 2008 & Windows R2 there were no official PowerShell Cmdlets available for Hyper-V. This is changed in Windows 8. Windows Server 8 has 162 PowerShell Cmdlets available for Hyper-V. Windows 8 uses PowerShell version 3.

Cmdlets are very powerful, that lets you automate all aspects of Hyper-V.  Here some guidance how-to find the Cmdlets you need.

 

To view all the Hyper-V PowerShell Cmdlets:

Get-Command -Module Hyper-V

To search for Cmdlets, for example with the name “host” in it: 

Get-Command -Module Hyper-V -Noun *host*

image

To get the Cmdlet syntax:

Get-VMHost -?

image

Get the Cmdlet syntax and available parameters, details and examples:

get-Help Get-VMHost -Full

image

More information over the Hyper-V Cmdlets can be found here. PowerShell 3.0 is available as Community Technology Preview (CTP) found here.

 

Hyper-V and hibernate

For my MS Hyper-V home server I want to hibernate every day between 12.30 and 07.00 am. When the Hyper-V role is installed, it is not possible to use the hibernate function. The following steps make it possible to automatic hibernate the system and when it wake up, the Hyper-V service and the VM(s) are started.

Steps:

1. Download “PowerShell Management Library for Hyper-V” file found here. Unblock the zone information from this zip, extract it and run the install file. Copy the content in the “HyperV_install” folder to “%windir%\System32\WindowsPowerShell\v1.0\Modules\HyperV

2. Edit VM properties of all VMs. Set the Automatic stop action “Shut down the guest operating system”

image

3. Edit the registy to disable auto start the hvboot service. When installing the hyper-v role the hibernate and sleep functionality is disabled.  There is no way to use the hiberate or sleep functionality while the Hyper-v service is running.  The Start property of a service can have the following values:

0=Boot
1=System (default)
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. Information found here.

2011-03-19 10h48_49

Reboot the server so that the hvboot service is not started.

4. Create 4 schedule tasks to run every day.

Name Time Action
1.Reboot Server 12.30 am shutdown /r t 30
2.Hibernate 12.40 am shutdown /h
3.Wake Up 07.00 am Under conditions select “Wake the computer to run this task”
4.Start HVboot & VMs 07.10 am powershell.exe -command "c:\powershell\startvm.ps1"

image

The startvm.ps1 script contains the following Powershell syntax:

001
002
003
import-module hyperv
start-service hvboot
start-vm -vm "Windows Home Server 2011"

Test if the schedule tasks are running fine by manually execute them and you’re ready to hibernate.

 

Microsoft Hyper-V (R2) link collection

Here’s a “handy” collection of links when designing, installing or troubleshooting a Microsoft Hyper-V (R2) environment. Even when studying for a Microsoft Hyper-V related exam this links can be useful.  On the moment i ’am preparing for the exam 70-659 Windows Server 2008 R2 Server Virtualization so i generated this list of links.

General

Windows 2008 R2 Virtualization calculator

Memory

Cluster

Networking

Servers

Software updates

Storage

Backup

VMs

P2V

Books

Forum

Video’s

Exams

If you have other “good” Microsoft Hyper-V related links let me know so can update this list.