2. Installing the Hyper-V role
Once you have planned the deployment of your Hyper-V hosts, you
are ready to install the Hyper-V role on the servers you plan to use
for this purpose. As with other server roles in Windows Server 2012,
the Hyper-V role can be installed on a server by using either of the
following:
You can use Server Manager to install the Hyper-V role on a
server as follows:
-
On either the All Servers page or a custom server group
page in Server Manager, right-click the remote server you want
to install the Hyper-V role on and select Add Roles And Features
to launch the Add Roles And Features Wizard.
-
On the Installation Type Wizard page, select Role-Based Or
Feature-Based Installation.
-
On the Server Roles page, select the Hyper-V role. At this
point, you will be prompted to install the GUI and Windows
PowerShell management tools for the Hyper-V role. If the server
you are installing the Hyper-V role on is a Server Core
installation, clear the Include Management Tools check
box.
-
Proceed through the remaining wizard pages to install the
role, and restart the remote server when prompted.
Note
Installing management tools on Server Core
If you are using Server Manager to install the Hyper-V role
on a remote server, you might want to select the Hyper-V Module
For Windows PowerShell on the Features page of the Add Roles And
Features Wizard to install this module locally on the server. That
way, if at some future time you are unable to manage the Hyper-V
role on the remote server using either the Hyper-V Manager snap-in
or Windows PowerShell, you might still be able to establish a
Remote Desktop session with the remote server so that you can run
Windows PowerShell commands locally on the server.
Alternatively, you might decide to install the Hyper-V role
on a Windows Server 2012 instance that has been configured with
the Minimal Server Interface installation option, which will allow
you to install both the Hyper-V Management snap-in and Hyper-V
Module For Windows PowerShell while retaining some of the security
and servicing advantages of the Server Core installation option.
When the Hyper-V role is installed on a server that has the
Minimal Server Interface installation, you can launch the Hyper-V
Management snap-in locally on the server by typing virtmgmt.msc at the command prompt. Note
that Minimal Server Interface is not available on the standalone
Windows Server 2012 Hyper-V product, which has only the Server
Core installation option.
You can also use Windows PowerShell to install the Hyper-V
role on a server. The command you use depends on the installation
option used when the remote server was deployed. For example, if the
remote server is a Server With A GUI installation, you can install
the Hyper-V role together with the management tools for the role by
using the following command:
Install-WindowsFeature -Name Hyper-V -ComputerName <name> -IncludeManagementTools -
Restart
Here <name> is the NetBIOS name, an
IP address, or fully qualified domain name (FQDN) of the remote
server. For example, to see what will happen if this command is run
against a server named HOST4, you can include the
–WhatIf parameter as follows:
PS C:\> Install-WindowsFeature -Name Hyper-V -ComputerName HOST4 -IncludeManagementTools
-Restart -WhatIf
What if: Continue with installation?
What if: Performing installation for "[Hyper-V] Hyper-V".
What if: Performing installation for "[Remote Server Administration Tools] Hyper-V
Module for Windows PowerShell".
What if: Performing installation for "[Remote Server Administration Tools] Hyper-V
Management Tools".
What if: Performing installation for "[Remote Server Administration Tools] Role
Administration Tools".
What if: Performing installation for "[Remote Server Administration Tools] Remote Server
Administration Tools".
What if: Performing installation for "[Remote Server Administration Tools] Hyper-V GUI
Management Tools".
What if: The target server may need to be restarted after the installation completes.
Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
True Maybe Success {Hyper-V, Hyper-V Module for Windows Power...
Run the command again without the –WhatIf
parameter to install the Hyper-V role on the remote server. After
the remote server has restarted, you can use the Get-WindowsFeature
cmdlet to verify installation of the Hyper-V role and associated
management features:
PS C:\> Get-WindowsFeature -Name *Hyper-V* -ComputerName HOST4 | `
ft DisplayName,InstallState
DisplayName InstallState
----------- ------------
Hyper-V Installed
Hyper-V Management Tools Installed
Hyper-V GUI Management Tools Installed
Hyper-V Module for Windows PowerShell Installed
Note
Advantages of the GUI approach
Although using the Install-WindowsFeature cmdlet of Windows
PowerShell is the preferred method for installing most roles and
features on remote servers running Windows Server 2012, there
might be some advantage to using the Add Roles And Features Wizard
when you want to install the Hyper-V role on a server. This is
because the wizard presents you with four Hyper-V configuration
options that you would have to configure separately using
different cmdlets after role installation if you are using Windows
PowerShell to install the role. These four configuration options
are
-
Configuring the default location for virtual disk
files
-
Configuring the default location for virtual machine
configuration files
-
Creating a new virtual switch
-
Enabling live migration
If you configure these settings during the installation of
the role using the wizard, you won’t need to configure them later
as part of the post-installation configuration of the host.