Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Windows Server 2016 Hyper-V Cookbook

You're reading from   Windows Server 2016 Hyper-V Cookbook Save time and resources by getting to know the best practices and intelligence from industry experts

Arrow left icon
Product type Paperback
Published in Jan 2017
Publisher Packt
ISBN-13 9781785884313
Length 524 pages
Edition 2nd Edition
Languages
Tools
Concepts
Arrow right icon
Authors (4):
Arrow left icon
Patrick Lownds Patrick Lownds
Author Profile Icon Patrick Lownds
Patrick Lownds
Leandro Carvalho Leandro Carvalho
Author Profile Icon Leandro Carvalho
Leandro Carvalho
Leandro Eduardo S Carvalho Leandro Eduardo S Carvalho
Author Profile Icon Leandro Eduardo S Carvalho
Leandro Eduardo S Carvalho
Charbel Nemnom Charbel Nemnom
Author Profile Icon Charbel Nemnom
Charbel Nemnom
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Installing and Managing Hyper-V in Full, Server Core, and Nano Server 2. Migrating and Upgrading Physical and Virtual Servers FREE CHAPTER 3. Managing Disk and Network Settings 4. Saving Time and Cost with Hyper-V Automation 5. Hyper-V Best Practices, Tips, and Tricks 6. Security and Delegation of Control 7. Configuring High Availability in Hyper-V 8. Disaster Recovery for Hyper-V 9. Azure Site Recovery and Azure Backup for Hyper-V 10. Monitoring, Tuning, and Troubleshooting Hyper-V A. Hyper-V Architecture and Components Index

Installing Windows Server 2016, Microsoft Hyper-V Server 2016, and Nano Server

After the prerequisites verification, we are now ready to install either the Windows Server 2016 or Microsoft Hyper-V Server 2016. The basic installation for both products is not so complicated, but it takes time to be finished. It would be interesting to identify the needs of a server provisioning for large deployment such as the Microsoft Deployment Toolkit (MDT) and System Center Virtual Machines Manager (SCVMM) which provides a unified collection of tools, processes, and guidance to automate this process, thus could result in both cost and time saving.

In case you want to use the Windows Server 2016 installation, it offers three deployment options: Full Server with desktop experience, Server Core, and Nano Server. The Full Server option provides a graphical interface to manage Hyper-V and Windows, including Hyper-V Manager, Server Manager, and all the other tools and services available on Windows. The problem in Full Server with desktop-experience option is that it comes with other components and services installed by default. That's why Microsoft introduced, in Windows Server 2008, a new installation method called Server Core, which is the default installation method in Windows Server 2016. This option does not come with the Graphical User Interface (GUI); instead, it has a command-line interface. With Server Core, we have more security and better performance in the host computer because only the core components of Windows are installed and features, such as the Internet and Windows Explorer are not present.

However, Microsoft went beyond Windows Server Core in Windows Server 2016 and introduced a new server deployment option called Nano Server.

Nano Server is a new headless, 64-bit only, deployment option in Windows Server 2016 that has been optimized for private clouds and data centers. It is similar to Windows Server in the Server Core mode, but significantly smaller, has no local log on capability, and only supports 64-bit applications, tools, and agents. It takes up lesser disk space, sets up significantly faster, requires fewer updates, and restarts faster than full Windows Server.

The major difference between Nano Server and Server Core is that none of the roles and features are available in the image as we get in Server Core and Full Server. In other words, when you add or install additional roles and features with Full Windows Server, it never prompts you for the media, all the binaries exist on your hard disk within the OS apart for .Net Framework 3.5. In Nano Server, all the Infrastructure roles live in separate packages, so you have to add them to the image. In this case, your base Nano Server image will always stay very small (zero-footprint).

As you add roles and features to Nano Server, some of them have additional dependencies which require additional space, as an example, the Hyper-V package requires only the Nano Server base OS, so the image will always be small and tight. Nano Server has full driver support, so any driver that works for Windows Server 2016, will work with Nano Server as well.

As a result, Nano Server deployment option provides the following improvements versus Server Core, Full Server, and Hyper-V Server:

  • Reduced maintenance and management
  • Less risk of bugs and failures
  • Less disk and memory requirements
  • Less updates and patches requirements
  • Less and faster reboot
  • More security

All these described options are available on Windows Server, which means that a Windows Server License has to be purchased, although there is a free version of Hyper-V called Hyper-V Server. This version is very similar to Windows Server Core installation, but it comes only with Hyper-V and failover clustering. The Hyper-V server contains all the features of Windows Server 2016 Hyper-V and Nano Server with Hyper-V role excluding RemoteFX, in other words, Remote Desktop Virtualization Host (RDVH) is not supported on the free Hyper-V Server.

In this task, you will see how to install Windows Server 2016 Hyper-V.

Getting ready

Before you start, make sure that you have the correct media file or DVD with the Windows Server 2016 installation image.

How to do it...

The following steps will walk you through the installation process of Windows Server 2016 and Nano Server:

  1. After the DVD boot process in the first screen, select your language, time and current format, keyboard or input method, and click on Next.
  2. On the second screen, click on Install now and the installation will automatically continue. If prompted, add the Windows Product Key and again click on Next.
  3. Select the operating system to be installed, as shown in the following screenshot, and then click on Next. As mentioned in the preceding section, Server Core is selected by default:
    How to do it...
  4. In order to install Windows Server 2016, you will have to accept the license terms. Select the I accept the license terms option and click on Next.
  5. For a new installation, select the option Custom: Install Windows only (Advanced), as shown in the following screenshot. The upgrade option for this version has been disabled:
    How to do it...
  6. In the Where do you want to install Windows screen, select the hard drive on which you want to install Windows Server and click on Next. For advanced driver options click on Drive options (advanced).
  7. If you have an external storage device or a hard drive that needs a driver to be loaded, click on Load Driver, as shown in the next screenshot, and install the proper drivers. Click on Next.
    How to do it...
  8. At this point, you need to wait for the installation to be completed. It can take from 10 to 30 minutes, based on your hardware.
  9. When it finishes, you will see the login screen asking you to provide the username and password. The default user is Administrator with a blank password. By default, Windows creates a blank administrator password. For the first login, the system prompts you to insert a password.

The installation for Nano Server is a little bit different; we have actually three different installation options, in a virtual machine, on a physical machine or in Microsoft Azure.

At the time of writing this book, the following list of roles and features (packages) have been added by Microsoft:

Role or Feature

Physical or Virtual Machine

Description

Compute-Package

Both

Hyper-V role

Storage-Package

Both

Storage role

Note: This package is only available for the Datacenter edition of Nano Server. However, the Storage and Failover Clustering packages contain all the storage features in this first release. If you install Failover Clustering you'll have Storage Spaces Direct, but you won't be able to use it on Standard edition as it calls licensing APIs and will not run, you'll only be able to use traditional clustering.

FailoverCluster-Package

Both

Failover Clustering role

Containers-Package

Both

Running Windows Server Containers and Hyper-V Containers

DNS-Package

Both

Running DNS Server

IIS-Package

Both

Running IIS Server

Defender-Package

Both

Anti-malware Defender package

OEM-Drivers-Package

Physical

The OEM package for Nano Server contains the same drivers that ship in-box with Server Core for physical machine deployment.

Guest-Package

Virtual

Drivers needed to host Nano Server in a VM

SCVMM-Package

Both

Helps in managing, deploying, and monitoring Nano Server with VMM

DSC-Package

Both

PowerShell DSC helps in simultaneously configuring large numbers of Nano servers in the push mode

DCB-Package

Both

DCB package is needed while configuring Network Datacenter Bridging

ShieldedVM-Package

Both

Deploying shielded virtual machines on top of Nano Server with Hyper-V role.

Note: This package is only available for the Datacenter edition of Nano Server

SecureStartup-Package

Both

Secure Startup includes support for BitLocker, Trusted Platform Module (TPM), volume encryption, platform identification, cryptography providers, and other functionality related to secure startup which is a prerequisite for Shielded VMs.

Host-Package

Physical

The Host package includes drivers, utilities, and services required for deploying to a physical machine.

SoftwareInventoryLogging-Package

Both

Software Inventory Logging (SIL) is a feature which helps server administrators retrieve a list of the Microsoft software that is installed on their servers. Note that the SIL package in Nano server is agent only, not the aggregator. More information about SIL can be found on TechNet (https://technet.microsoft.com/en-us/library/dn268301(v=ws.11).aspx).

Before we deploy Nano Server, we need to create a Nano Server image, we have two options to do so, we can use the new PowerShell module that ships with Windows Server 2016 media or we can use Nano Server Image Builder, which can now be downloaded from the Microsoft download center.

In the following section we will cover both options.

Create a Nano Server Image using PowerShell

We will start by creating a folder on the machine that you will use for the Nano Server creation process. For instance, you can create a folder named C:\NanoServer. After creating this folder, there are four resources that you must have saved in that folder. These resources include:

In fact, all the resources are included in Windows Server 2016 ISO media under the NanoServer folder, you can mount the ISO image and copy the required components, verify that all are in the correct folder. Next, open Windows PowerShell and import the NanoServerImageGenerator.psm1 module. While doing so, you can start creating the image using the New-NanoServerImage commandlet (cmdlet).

The default Nano Server image that ships with Windows Server 2016 requires customization. Customizations include adding Nano Server packages based on the role the server will play in the environment, which is Hyper-V in this case, the addition of boot critical drivers, and an unattend.xml file to complete the setup process. This chapter covers only a few customizations and deployment scenarios.

We will create a new VHD image using the New-NanoServerImage cmdlet; the computer name will be NanoServer01 and have OEM drivers installed for most common hardware and has the Hyper-V role, clustering feature, and the Emergency Management Services (EMS) enabled.

Note

Make sure to run the following script on a computer member of a domain where Nano Server will be deployed and update the IP addresses to match your environment.

#region Generate Nano Server image with Hyper-V Server role installed
#region Variables

$ComputerName = 'NanoServer01'
$StagingPath = 'C:\Temp' # Staging path for new image
$ServerISO = 'C:\Temp\WindowsServer2016.ISO' # Path to Windows Server 2016 ISO file
# Mount the ISO Image
Mount-DiskImage $ServerISO
# Get the Drive Letter of the disk ISO image
$DVDDriveLetter = (Get-DiskImage $ServerISO | Get-Volume).DriveLetter 
$MediaPath = ($DVDDriveLetter + ':\')
$DomainName = $env:USERDNSDOMAIN.ToLower()
$Path = Join-Path -Path $StagingPath -ChildPath NanoServer
$Password = Read-Host -Prompt Password -AsSecureString

#endregion Variables

#region Copy source files
if (-not (Test-Path $StagingPath)) {
mkdir $StagingPath
}

$NanoServerSourcePath = Join-Path -Path $MediaPath -ChildPath NanoServer -Resolve
Copy-Item -Path $NanoServerSourcePath -Destination $StagingPath -Recurse -Force

#endregion

#region Generate Nano Hyper-V image
Import-Module -Name (Join-Path -Path $Path -ChildPath NanoServerImageGenerator\NanoServerImageGenerator.psm1) -Verbose

$NanoServerImageParameters = @{

ComputerName = $ComputerName
DeploymentType = 'host'
Edition = 'Datacenter'
MediaPath = $MediaPath
BasePath = (Join-Path -Path $Path -ChildPath $ComputerName)
TargetPath = Join-Path -Path $Path -ChildPath ($ComputerName + '.vhd')
DomainName = $DomainName
AdministratorPassword = $Password
Ipv4Address = '172.16.20.120' 
Ipv4SubnetMask = '255.255.255.0' 
Ipv4Gateway = '172.16.20.1' 
Ipv4Dns = '172.16.20.9'
InterfaceNameOrIndex = 'Ethernet' 
Compute = $true
Package = 'Microsoft-NanoServer-Compute-Package'
EnableRemoteManagementPort = $true
OEMDrivers = $true
Clustering = $true
EnableEMS = $true
}

New-NanoServerImage @NanoServerImageParameters

#endregion

# Dismount Windows Server 2016 ISO Image
Dismount-DiskImage $ServerISO

#endregion 

If the physical server uses UEFI to boot, then make sure to change .vhd to .vhdx.

Create a Nano Server image using Nano Server Image Builder

The Nano Server Image Builder is a GUI-based wizard that helps you create a custom Nano Server image and bootable USB media. The Nano Server Image Builder is based on the inputs you provide, it generates images for deployment and also creates reusable PowerShell scripts that allow you to automate the image creation process.

To create a Nano Server Image using Nano Server Image Builder, there are three resources that you must have ready. These resources include:

You need to install Windows Assessment and Deployment Kit (ADK) on the machine that you will use to create Nano Server image, using Nano Server Image Builder.

When ADK is installed, launch Nano Server Image Builder and select the prefer method of creating the image, as shown in the following screenshot:

Create a Nano Server image using Nano Server Image Builder

Make sure you have downloaded Windows Server 2016 ISO and extracted it to a folder on your machine, click on Create a new Nano Server image, select a location for the media source, and then click on Next:

Create a Nano Server image using Nano Server Image Builder

Accept the License Agreement, click on Next and then choose your deployment type:

  • Virtual machine images: This can be .vhd or .vhdx
  • Physical machine images: This can be .vhd, .vhdx, or .wim

In this case, I will select a physical machine image:

Create a Nano Server image using Nano Server Image Builder

Click on Next twice and then select the Nano Server Edition (Standard or Datacenter) and the optional packages that you want to add as a part of the image, as shown in the next screenshot:

Create a Nano Server image using Nano Server Image Builder

Since we are creating an image for the physical machine, the Server Core drivers is selected by default; we have added the Hyper-V role, Failover Clustering Service, and File Server role. Click on Next, you can add additional drivers provided by the OEM vendor if needed. In the Destination machine information, you need to provide the Computer name, local Administrator password, and the preferred Time zone, as shown in the following screenshot:

Create a Nano Server image using Nano Server Image Builder

Click on Next, enter a domain name that can be used as the existing Active Directory account or you can provision a computer account metadata blob file. Click on Next, in the Set network, you can enable for PowerShell remote management from all subnets, enable VLAN ID, and configure network settings (DHCP or Static), as shown in the following screenshot:

Create a Nano Server image using Nano Server Image Builder

Click on Next, you can now proceed and create a basic Nano Server image or continue to configure advanced settings, such as (add update packages, embed files and commands to run when setup completes, enable Emergency Management Services (EMS), and enable support for development scenarios and debugging methods). In this example, we will proceed by creating a basic Nano Server image. Click on Create, when ready, and the image creation will start, as shown in the next screenshot. The image creation process will take between eight to thirteen minutes, depending on your machine speed. As mentioned earlier, you can also copy the PowerShell command and use it to automate the image creation:

Create a Nano Server image using Nano Server Image Builder

Deploy Nano Server on a physical machine

There are a few ways to deploy Nano Server to a physical machine:

  • Dual-boot a Nano Server VHD, or VHD(X)
  • PxE-boot a bare-metal machine and install Nano Server from WDS using a VHD or VHD(X)
  • PxE-boot a bare-metal machine and install Nano Server from WDS using a .wim file
  • Booting a bare-metal machine into WinPE and deploying Nano Server using a .wim file

It is important to reiterate that there are multiple ways to configure and deploy Nano Server; this chapter covers just the first deployment option for the readers to get started.

I strongly encourage you to check the Getting Started with Windows Nano Server book by Packt for in depth details about Nano Server. Check out https://www.packtpub.com/virtualization-and-cloud/getting-started-windows-nano-server.

To quickly deploy Nano Server on a physical computer, you need to have a generalized Nano Server VHD or VHD(X) image ready, which we created in the previous section.

To configure the physical machine to boot from this new VHD(X), please follow these steps:

  1. We need to add an entry to the boot database using bcdboot, but before we add this entry, let's look at the current boot database by running bcdedit, as shown in the following screenshot:
    Deploy Nano Server on a physical machine

    As you can see we have a single entry as identifier called {current}.

  2. Next, we need to add a new entry to the BCD store, so in addition to the current operating system, which in this example is Windows Server 2012 R2, we would like to add another boot entry, in order to do that we need to use bcdboot.
  3. Copy the VHD(X) that we created in the previous section to the physical computer and configure it to boot from this new VHD. To do that, follow these steps:

    Mount the generated VHD. In this example, it's mounded under E:\ as shown in the following screenshot:

    # Nano Server 2016 VHD Image
    $NanoImage = "C:\Nano\NanoServer01.vhd"
    # Mount the VHD Image
    Mount-DiskImage $NanoImage -Verbose
    # Get the Drive Letter of the VHD image
    (Get-DiskImage –ImagePath $NanoImage  | Get-Disk | `  Get-Partition | Get-Volume).DriveLetter 
    Deploy Nano Server on a physical machine
    1. Run bcdboot e:\windows /v.
    2. Unmount the VHD by running: Dismount-DiskImage $NanoImage.
  4. Let's now look at the bcdedit settings, as shown in the following screenshot:
    Deploy Nano Server on a physical machine

    As you can see, bcdboot has updated all boot files (such as bootmgr), and took the bcd template from the Nano image you want to boot from and stamp it into the BCD store and update the device paths. Now, you will know for sure that the paths are correct, the entry is correct, and the binaries have supported versions.

    Note

    You could possibly accomplish something similar with bcdedit, but with bcdedit you would need to manually set the VHD path, which is easy to get wrong. If you are not careful while copying different entries, you will end up booting the OS with an incorrect boot configuration. On top of that bcdedit will not update the binaries, which could result in an unsupported configuration. As the best practice, use bcdboot.

    Lets reboot the physical machine now and show you what the boot process looks like:

    Deploy Nano Server on a physical machine
  5. Wait for a couple of seconds until Nano Server boots and then log on to the Recovery Console, as shown in the following screenshot using the user name (in this case: Administrator) and password you supplied while creating the Nano Server image:
    Deploy Nano Server on a physical machine

How it works...

The process to install a free Hyper-V Server and Windows Server (Core or Full Server) is the same. However, for Nano Server you need to customize and create the image according to the use case. The setup will install all the necessary components only to run Hyper-V without any other services (or applications, in case of Hyper-V Server). The first step in the installation procedure is to load the boot.wim setup image file and after the preceding process, setup applies the install.wim image file containing the OS image.

In case of Hyper-V Server and Windows Server (Core or Full Server), once the installation is completed, you will be prompted to change the administrator password and the system will be ready to be used.

See also

  • The Managing a Server Core installation using sconfig recipe in this chapter
  • The Remotely managing a Nano Server installation recipe in this chapter
  • The Chapter 5, Hyper-V Best Practices, Tips, and Tricks
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime