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:
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
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
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
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
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:
On the server desktop, open Server Manager (Figure 6).
Figure 6: Windows Server 2012 – Server Manager Console
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
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
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
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
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
On the Select Server Roles page (Figure 12), click Next.
Figure 12: Add Roles and Features Wizard – Select Server Roles Page
On the Select Features page (Figure 13), click Next.
Figure 13: Add Roles and Features Wizard – Select Features Page
On the Hyper-V Page (Figure 14), click Next.
Figure 14: Add Roles and Features Wizard – Hyper-V Page
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
On the Virtual Machine Migration page (Figure 16), click Next.
Figure 16: Add Roles and Features Wizard – Virtual Machine Migration Page
On the Default Stores page (Figure 17), click Next.
Figure 17: Add Roles and Features Wizard – Default Stores Page
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
On the Confirmation page (Figure 19), click Install.
Figure 19: Add Roles and Features Wizard – Confirmation Page
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
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:
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’
Modify the Virtual Machine files storage location to be the same as the Virtual Hard Disks path:
Set-VMHost –VirtualMachinePath ‘D:\Virtual Machines’
Modify NUMA Spanning to be enabled:
Set-VMHost –NumaSpanningEnabled $True
Modify the number of concurrent Live Migrations to 4 events:
Set-VMHost –MaximumVirtualMachineMigrations 4
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:
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
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
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:
On the server desktop, open the Server Manager (Figure 25).
Figure 25: Windows Server 2012 – Server Manager Console
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
In Hyper-V Manager, in the Actions pane, click Hyper-V Settings (Figure 27).
Figure 27: Hyper-V Manager Console
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
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
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
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
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:
In Hyper-V Manager, in the Actions pane, click Virtual Switch Manager (Figure 33).
Figure 33: Virtual Switch Manager Console
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