Installing and Configuring Windows Server 2012 Hyper-V (Part 2)

by [Published on 7 Feb. 2013 / Last Updated on 7 Feb. 2013]

In Part II of this article, you learn how to install the Hyper-V role and configure basic Hyper-V host settings on Windows Server 2012.

If you would like to be notified of when Janique Carbone releases the next part in this article series please sign up to our VirtualizationAdmin.com Real-Time Article Update newsletter.

If you would like to read the first part in this article series please go to Installing and Configuring Windows Server 2012 Hyper-V (Part 1).

Introduction

In Part II of this article, you learn how to install the Hyper-V role and configure basic Hyper-V host settings on Windows Server 2012. You are introduced to Windows PowerShell cmdlets to configure a Server Core Installation, and the Server Manager and Hyper-V Manager consoles installed on a Server with a GUI installation.

Installing Hyper-V on a Server Core Installation

A Server Core installation entails the configuration of Windows Server 2012 without the Server Graphical Shell. In terms of system administration and configuration, this means that you either manage a server from the local console or remotely using a command line interface or Windows PowerShell, or you administer a server from a remote workstation using Microsoft Management Console based tools.

Here are the basic steps to install the Hyper-V role on a Server Core Installation of Windows Server 2012 using Windows PowerShell:

  1. At the Server Core installation console, a command line window opens after login (Figure 1).  


Figure 1:
Windows Server 2012 Server Core Installation Command Line

  1. As shown in Figure 2, type PowerShell in the command window to access the Windows PowerShell interface.


Figure 2:
Windows Server 2012 Command Windows – Starting PowerShell

  1. Type Get-WindowsFeature at the PowerShell Command Line (Figure 3) to view the server roles and features that are installed or available on the server.


Figure 3:
Windows Server 2012 – Get-WindowsFeature PowerShell Cmdlet

  1. Type Install-WindowsFeature –Name Hyper-V – Restart to install the Hyper-V role and automatically restart the server after the installation of the role. (Figure 4).


Figure 4: Windows Server 2012 – Install-WindowsFeature PowerShell Cmdlet

  1. After the server restarts, start PowerShell from the command window, and type Get-WindowsFeature | where {$_.Installed –eq $True} to verify the successful installation of the Hyper-V role (Figure 5).


Figure 5:
Windows Server 2012 Hyper-V Role Verification in Windows PowerShell

The command output is formatted to display only a list of the roles and features that are installed on the server, rather than the entire list of roles and features available. Using Windows PowerShell, roles and features can be installed individually as shown in this example, or you can install multiple roles and features using a single cmdlet. For example, you can install the Hyper-V and Web Server roles using the following syntax: Install-WindowsFeature –Name Hyper-V, Web-Server – Restart.

Installing Hyper-V on a Server with a GUI Installation

In order to install the Hyper-V role on a Server with a GUI installation, you can also use Windows PowerShell, or you can use the Server Manager if you prefer a graphical user interface:

  1. On the server desktop, open Server Manager (Figure 6).


Figure 6:
Windows Server 2012 – Server Manager Console

  1. In Server Manager, in the menu, click Manage, and then click Add Roles and Features (Figure 7).


Figure 7:
Server Manager Console – Add Roles and Features Selection

  1. In the Add Roles and Features Wizard (Figure 8), on the Before You Begin page, select Next.


Figure 8:
Add Roles and Features Wizard - Before You Begin Page

  1. On the Select Installation Type page (Figure 9), select Role-based or feature-based installation, and click Next.


Figure 9:
Add Roles and Features Wizard – Select Installation Type Page

  1. On the Select Destination Server page (Figure 10), select the server, and click Next.


Figure 10:
Add Roles and Features Wizard – Select Destination Server Page

  1. On the Select Server Roles page (Figure 11), select Hyper-V, and then click Add Features in the dialog box.


Figure 11:
Add Roles and Features Wizard – Add Features Dialog

  1. On the Select Server Roles page (Figure 12), click Next.


Figure 12: Add Roles and Features Wizard – Select Server Roles Page

  1. On the Select Features page (Figure 13), click Next.


Figure 13:
Add Roles and Features Wizard – Select Features Page

  1. On the Hyper-V Page (Figure 14), click Next.


Figure 14:
Add Roles and Features Wizard – Hyper-V Page

  1. On the Create Virtual Switches page (Figure 15), select a network adapter, and then click Next.


Figure 15:
Add Roles and Features Wizard – Create Virtual Switches Page

  1. On the Virtual Machine Migration page (Figure 16), click Next.


Figure 16:
Add Roles and Features Wizard – Virtual Machine Migration Page

  1. On the Default Stores page (Figure 17), click Next.


Figure 17:
Add Roles and Features Wizard – Default Stores Page

  1. On the Confirmation page (Figure 18), check Restart the destination server automatically if required, and then click Yes in the restart dialog box.


Figure 18:
Add Roles and Features Wizard – Restart Dialog Box

  1. On the Confirmation page (Figure 19), click Install.


Figure 19:
Add Roles and Features Wizard – Confirmation Page

  1. On the Installation Progress page (Figure 20), you can monitor the Hyper-V role installation until the server automatically restarts.


Figure 20:
Add Roles and Features Wizard – Installation Progress Page

  1. After the server restarts and opens the Server Manager, check the Installation Progress page (Figure 21) to ensure that the Hyper-V role installlation was successful, and then click Close.


Figure 21:
Add Roles and Features Wizard – Installation Progress Page

Configuring Hyper-V Host Settings on a Server Core Installation

After installing the Hyper-V role on a server, you can perform configuration of Hyper-V host settings. Basic settings include the following items:

  • Configuration of the storage locations for virtual hard disk and virtual machine configuration files
  • Configuration of physical GPUs for use with RemoteFX (if the Remote Desktop Virtualization Host role is installed)
  • Configuration of NUMA spanning when the server has NUMA nodes to enhance virtual machine performance
  • Configuration of Live Migration and the authentication protocol to use, the number of simultaneous live migrations to allow (default is 2), and the server networks to support live migration events
  • Configuration of Storage Migration and configuring the number of simultaneous storage migrations to allow (default is 2)
  • Configuration of Replication to support the server Replica functionality and the authentication protocol to use, as well as the servers authorized to replicate

The following cmdlets provide examples of how to configure some of these basic Hyper-V host settings using Windows PowerShell:

  1. Modify the Virtual Hard Disk storage location to use a folder named Virtual Machines on drive D (just as an example, of course, as you customize drive and folder locations to suit your requirements):
    Set-VMHost –VirtualHardDiskPath ‘D:\Virtual Machines’
  1. Modify the Virtual Machine files storage location to be the same as the Virtual Hard Disks path:
    Set-VMHost –VirtualMachinePath ‘D:\Virtual Machines’
  1. Modify NUMA Spanning to be enabled:
    Set-VMHost –NumaSpanningEnabled $True
  1. Modify the number of concurrent Live Migrations to 4 events:
    Set-VMHost –MaximumVirtualMachineMigrations 4
  1. Modify the number of concurrent Storage Migrations to 4 events:
    Set-VMHost –MaximumStorageMigrations 4

In addition to basic Hyper-V host settings, you can also use Windows PowerShell to verify host network adapter settings, and configure Virtual Switch settings.

The following cmdlets provide examples of how to list network adapter information and IP addresses on a Hyper-V host, as well as how to configure a Virtual Switch:

  1. List the physical network adapters present in the Hyper-V host using Format-Table (ft in the cmdlet below) to list by name (Figure 22):
    Get-NetAdapter | ft Name


Figure 22: Format-Table Output for Get-NetAdapter | ft Name Cmdlet

  1. List the settings of a network adapter using the Network Adapter name (Figure 23):
    Get-NetAdapter -Name ‘NIC1’ | Get-NetIPAddress


Figure 23: Output of Get-NetIPAddress cmdlet for Network Adapter NIC1

  1. Create a new external Virtual Switch using the network adapter named NIC1, name the virtual switch Public, and allow the parent partition to have access to the network adapter bound to the virtual switch (Figure 24):
    New-VMSwitch -Name "Public" -NetAdapterName ‘NIC1’ -AllowManagementOS $True


Figure 24: Output of New-VMSwitch Cmdlet

For a complete list of Windows PowerShell cmdlets that are available to script and automate Hyper-V related tasks, you can refer to the Microsoft Technet Hyper-V Cmdlet site here.

Configuring Hyper-V Host Settings on a Server with a GUI Installation

If Windows PowerShell cmdlets don’t appeal to you, or you have access to a Server with a GUI installation, you can configure Hyper-V host settings using the Hyper-V Manage:

  1. On the server desktop, open the Server Manager (Figure 25).


Figure 25:
Windows Server 2012 – Server Manager Console

  1. In Server Manager, in the navigation pane, click Hyper-V, then right-click the server, and then select Hyper-V Manager from the list (Figure 26).


Figure 26:
Server Manager Console – Hyper-V Manager Selection

  1. In Hyper-V Manager, in the Actions pane, click Hyper-V Settings (Figure 27).


Figure 27:
Hyper-V Manager Console

  1. On the Hyper-V Settings page, select Virtual Hard Disks to specify the default drive and folder to store virtual hard disk files, and then click Apply (Figure 28).


Figure 28:
Hyper-V Manager – Virtual Hard Disks Page

  1. On the Hyper-V Settings page, select Virtual Machines to specify the default folder to store virtual machine configuration files, and then click Apply (Figure 29).


Figure 29:
Hyper-V Manager – Virtual Machines Page

  1. On the Hyper-V Settings page, select NUMA Spanning to enable the setting, and then click Apply (Figure 30).


Figure 30:
Hyper-V Manager – NUMA Spanning Page

  1. On the Hyper-V Settings page, select Live Migrations to set the number of simultaneous live migrations that are allowed, and then click Apply (Figure 31). Note that this setting requires the server to be a member of an Active Directory domain.


Figure 31: Hyper-V Manager – Live Migrations Page

  1. On the Hyper-V Settings page, select Storage Migrations to set the number of simultaneous storage migrations that are allowed, and then click Apply (Figure 32).


Figure 32:
Hyper-V Manager – Storage Migrations Page

You can use the Virtual Switch Manager to create and manage virtual switches in Hyper-V:

  1. In Hyper-V Manager, in the Actions pane, click Virtual Switch Manager (Figure 33).


Figure 33:
Virtual Switch Manager Console

  1. Create a new external Virtual Switch, name the virtual switch Public, allow the parent partition to have access to the network adapter bound to the virtual switch, and then click Apply (Figure 34).


Figure 34:
Virtual Switch Manager – New Virtual Switch Creation

Conclusion

In this article, you learned some basics about the Windows PowerShell and graphical console options available to install the Hyper-V role and configure Hyper-V host settings in Windows Server 2012. These tools can be used to configure a single server or multiple servers that require identical configurations. In addition, you can use these tools in combination to manage any type of Windows Server 2012 installation either locally or when necessary remotely as would be the case for a Server Core installation to be managed using Server Manager and Hyper-V Manager.

If you would like to be notified of when Janique Carbone releases the next part in this article series please sign up to our VirtualizationAdmin.com Real-Time Article Update newsletter.

If you would like to read the first part in this article series please go to Installing and Configuring Windows Server 2012 Hyper-V (Part 1).

Featured Links