Nano Server isn’t like other types of Windows Server deployments. There is no Nano Server deployment option within Windows Server setup. Likewise, Virtual Machine Manager does not include any predefined Nano Server templates. If you want to use Virtual Machine Manager 2016 to deploy Nano Server, then you will need to start by creating a Nano Server VHD that can be used by the template creation process.
The first step to creating this VHD is to create a Nano Server deployment folder. Log onto a server that is running the Windows Server 2016 operating system and open an administrative PowerShell session. We need to copy the Nano Server folder that is located on the Windows Server installation media to the server’s hard disk. Assuming that the installation media is mounted in D:. the command looks like this:
Copy-Item -Path D:\NanoServer\ -Destination C:\NanoServer\ -Recurse
Now you will need to import the Nano Server Image Generator module. The commands used for doing this are:
C: CD\ CD NanoServer Import-Module .\NanoServerImageGenerator\NanoServerImageGenerator.psd1
You can see what these commands look like in the figure below:
You will need to import the Nano Server Image Generator.
Now it’s time to create the Nano Server VHD file. Before we do that however, open File Explorer and navigate to C:\NanoServer\Packages. Packages are designed to provide functionality within Nano Server. They aren’t exactly the same thing, but I tend to think of adding a package as being similar to installing Windows Server roles or features. If you take a look at the figure below, you will see the packages that currently exist in the Packages folder.
There are several Nano Server packages to choose from.
As you look at the figure above, you will notice that there are two packages with names that reference VMM. You will need to include the Microsoft-NanoServer-SCVMM-Package into the virtual hard disk that you are creating. This package adds the Virtual Machine Manager agent to the Nano Server VHD.
The other VMM related package is called Microsoft-NanoServer-SCVMM-Compute-Package. This package is used for managing Hyper-V hosts. As such, you won’t need to include this package in your VHD.
For the purposes of this article, I am only going to be deploying the Microsoft-NanoServer-SCVMM-Package file. In a production environment, you would want to create a variety of Nano Server VHDs, each of which will eventually act as a template for various types of Nano Servers. For example, you might create a VHD that can function as a Nano file server template, and maybe another VHD to act as a Nano IIS server template. In the interest of simplicity however, I am just going to create a generic Nano Server template.
So with that said, here is where things get a little bit dicey. Normally, you should be able to use a command like this one to create the VHD file.
New-NanoServerImage -MediaPath D:\ -BasePath .\Base -TargetPath .\NanoTemplate\NanoTemplate.VHD -ComputerName GenericNano -OEMDrivers -Clustering -EnableRemoteManagementPort -Packages Microsoft-NanoServer-SCVMM-Package
If memory serves me, I’m pretty sure that this technique worked while Windows Server 2016 was in its Release Preview. However, there is currently a bug in the New-NanoServerImage cmdlet that causes the Packages parameter to not be recognized. The funny thing is that if you type New-NanoServerImage -? then the syntax that is displayed verifies that Packages is a valid parameter. You can see what I mean in the figure below:
A bug prevents the Packages parameter from being accepted.
Because of this, we will have to use an alternate technique to create the VHD file. One option is to use the New-NanoServerImage cmdlet to create a basic VHD file, and then use the DISM command to inject packages into the VHD. Another, much easier option is to use a newly released utility to create the VHD file.
Microsoft has recently released a new tool called the Nano Server Image Builder. This tool lets you use a GUI interface to create a Nano Server VHD file. You can download the tool at: https://www.microsoft.com/en-us/download/details.aspx?id=54065 You can get a feel for what this tool does in the figure below.
The Nano Server Image Builder is a free, graphical tool for creating Nano Server images.
Regardless of which tool you use to create the VHD file, it is important to test the VHD file to make sure that it boots correctly Depending on how you made the VHD, you may also need to perform a bit of additional configuration.
You can test the VHD file by using either Hyper-V Manager, Virtual Machine Manager, or Windows PowerShell to create a new virtual machine that is linked to the VHD file that you just created. Once you have created the virtual machine, go ahead and launch the VM, and connect to the virtual machine console. You will need to make sure that the Nano Server boots correctly, and that the recovery console shown in the figure below is accessible.
Make sure that you can access the Nano Server’s recovery console.
For right now, verify that you are able to log into the recovery console. You should also make sure that the Nano Server’s network adapter is able to successfully connect to the network (you can view the IP configuration from inside of the recovery console). When you are done, you can shut down and delete the virtual machine. Just make sure that you don’t accidentally delete the VHD file.
In this article, we have created a Nano Server VHD file, and verified that the file is bootable. Although we could use this Nano Server as is, the ultimate goal is to turn the VHD into a Virtual Machine Manager template. I will show you how to do that in the next article.