How to create a Nano Server Image

Creating a Nano Server Image

Unlike other versions of Windows Nano Server does not have install media to load onto a VM or Physical Host.  Instead, a base level Nano WIM, Nano Packages, and Nano scripts are used in conjunction with the New-NanoServerImage cmdlet to create a Nano Server image (vhd/vhdx) that can be used to deploy to a VM or physical host.

At a high level a Nano Server image is created using the New-NanoServerImage cmdlet that is part of the NanoServerImageGenerator module found on the 2016 Server ISO media.  This cmdlet will engage the Nano media located on the Windows Server 2016 ISO to create an image by using the NanoServer.wim and Nano packages.

Prerequisites

  • Supported Operating Systems
    • Server 2016, Windows 10 (Native)
      • The image generation process engages the latest ADK which is native to these OS’s
    • Server 2012R2, Windows 8.1, Windows 8 (with correct ADK installed)
      • If you do not have access to a Windows 10 or Server 2016 device you will need to download and install the Windows 10 ADK: Download the Windows ADK
  • A copy of the Nano media obtained from the NanoServer folder on the Windows Server 2016 installation media
    • If you do not have a copy of the Windows Server 2016 installation media you can snag an evaluation copy here: Evaluate Windows Server 2016
    • You can also leverage your MSDN subscription to obtain Windows Server 2016 installation media
    • Windows Server 2016 - NanoServer Media files

Nano Server Image Builder Guide

The prerequisites and the New-NanoServerImage cmdlet is all that’s required to create a Nano Server image.  Running New-NanoServerImage with the desired parameters will engage the Nano Server media to create your desired Nano Server Image.

That being said the syntax for New-NanoServerImage is a bit complex and it’s staggering array of options can make creating the image a bit tasking so Microsoft has released the Nano Server Image Builder which you can download here.

All the Nano Server Image Builder tool is really doing is properly structuring the New-NanoServerImage command based on a series of GUI selections you make in the wizard.  In fact, once complete with the wizard you are given the option of just copying the properly formatted syntax for later use.

The following walk-through will guide you through creating a Nano Server Image for a physical host using Microsoft’s Nano Server Image Builder

If you prefer video over written format the following TechThoughts video contains a short example of creating a Nano Server image for a VM:

Note that this process will differ slightly when creating a Nano Server Image for a VM

  1.  Open the Nano Server Image Builder and click Create a new Nano Server Image
    • Nano Server Image Builder - Create a New Nano Server Image
  2. Creation of the Nano Image requires the path to the Nano media found on the Windows Server 2016 installation media
    • Nano Server Image Builder - Select Installation Media
  3. Agree to the terms
    • Nano Server Image Builder - Review License Terms
  4. Configure the deployment type and vhd/vhdx name as well as the maximum size of the image
    • It is especially crucial on this step to indicate whether Nano will be deployed to a VM or Physical machine
    • Nano Server Image Builder - Deployment Type
  5. Determine if hardware configuration scanning is required
    • The image generator is capable of creating a USB based scanning utility that you can boot a physical chassis to. The utility will scan the hardware and determine if it is suitable for Nano deployment by generating a series of log results.  You only receive this option if deploying to a physical chassis and this step is only required if you are unsure if Nano will be supported on your hardware.
    • Nano Server Image Builder - Hardware Configuration
  6. Select desired packages and server edition
    • Choose the desired packages that you will add to your Nano image – this will determine what capabilities the server will have
    • Nano Server Image Builder - Select Optional Packages
  7. Add any additional drivers that are required to the image
    • Nano Server Image Builder - Add drivers
  8. Specify Computer Name, Admin Password and time zone
    • Nano Server Image Builder - Destination Machine Information
  9. Nano server is not capable of “joining a domain” in the traditional sense.  It is capable of being part of a domain though using a form of off-line domain joining
    • If you are running the Nano Server Image Builder on a device that is already joined to the desired domain and are running as a domain admin you can click the Join Domain button and specify the domain and the necessary file will be created and injected into the image for you.
      • Note, that the device name must have a corresponding AD object that has not been used previously
    • If you are not running the Nano Server Image Builder on a device that is already joined to a domain, then you will need to manually generate the Domain blob file and specify it’s location.
      • On the DC ensure you have pre-created an ADObject for the corresponding device and then run the following:
        Offline Domain Join Blob File Creation

        • djoin.exe /provision /domain yourdomain.local /machine MachineName /REUSE /savefile .\odjblob
          
      • You will now need to copy the Blob file you have created and specify it’s location
    • Nano Server Image Builder - Join Domain
  10. Specify accessibility and network settings
    • It is highly recommended that you enable WinRM access to the Nano device as this will prove very useful for managing your new Nano Server.
    • The Nano console does allow you to IP the device once it boots up – so you do not have to specify IP address information in the image.
      • I personally have not had much success with setting the network settings in the image itself.  It is based on Network Adapter index which varies from machine to machine and is challenging to predetermine in some cases.
    • Nano Server Image Builder - Set Network
  11. Create the image if ready or continue to configure advanced settings
    • Nano Server Image Builder - Advanced Settings
  12. Add servicing packages
    • Nano updates are available for offline download and can be injected into the image to reduce patching when the server first boots up
    • Nano Server Image Builder - Add servicing packages
  13. Enable any desired remote options
    • If you have EMS capabilities in your environment you can specify those here
    • Nano Server Image Builder - Remote options
  14. Review and create Nano Image
    • Nano Server Image Builder - Review all settings

Manually Creating a Nano Server Image

You can create a Nano image manually by leveraging the New-NanoServerImage cmdlet.

New-NanoServerImage Example

New-NanoServerImage -DeploymentType Guest `
                    -Edition Datacenter `
                    -MediaPath $path `
                    -BasePath .\Base `
                    -TargetPath $NanoVHDPath2 `
                    -MaxSize 10737418240 `
                    -ComputerName $Computername `
                    -Clustering `
                    -Package Microsoft-NanoServer-ShieldedVM-Package `
                    -Defender `
                    -EnableRemoteManagementPort `
                    -AdministratorPassword $SecurePassword

In the above manual example a VM Nano Server image will be created (-DeploymentType Guest).  It will have the clustering feature added, support becoming a shielded VM, have Windows Defender installed, and support remote management over WinRM.  Note that some of the more popular server features/roles have their own switches (-Clustering) but these can also be added to the package parameter (-Package Microsoft-NanoServer-FailoverCluster-Package).  Either method achieves the same results.  The administrator password will need to be a secure string variable which you can easily convert from a plain text password.

Evaluate an existing Nano Image

Checking a Nano Image to determine what packages are installed.

In order to evaluate a previously created Nano Server image the NanoServerPackage is required.  The below code example will install this for you if it is not already present on your system.

Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Save-Module -Path "$env:ProgramFiles\WindowsPowerShell\Modules" -Name NanoServerPackage -MinimumVersion 1.0.0.0
Import-PackageProvider NanoServerPackage
Get-Package -provider NanoserverPackage -fromVhd c:\MyNanoVhd.vhd

NanoGen – another example

Prior to the release of the Nano Server Image Builder by Microsoft I had created a similar tool, NanoGen.

Usage of this tool is no longer recommended in favor of the Nano Server Image Builder but NanoGen can still provide a great deal of insight into how these tools work and how to manually create a Nano Server Image.

You can get NanoGen from the repo here:

https://github.com/techthoughts2/NanoGen

Further customize your Nano Server Deployment

It is possible to perform numerous post deployment customization using the SetupComplete.cmd file.  Check out my post:

Customizing Nano deployment using SetupComplete.cmd for more info

Additional Reading

3 Responses

  1. Miguel Paton de Escalada says:

    I think it is very easy and probably faster to create nano servers, add static ip @, joining it to a domain and add the necessary packages by using the manual way. I have created a video that shows how easy is it:

    https://youtu.be/Pxu4MNkhVQg

    On the other hand, Nano Server Image Builder seems to be very useful to quickly create a bootable USB drive or ISO using an existing Nano Server Image. I think I will use it the next time I will need it.

  1. November 29, 2016

    […] possible to set many options in the actual Nano Server image you will likely find yourself needing to perform a few post deployment customization tasks.  These […]

  2. December 5, 2016

    […] Hyper-V to Nano Server is relatively straight forward.  A Nano Server image should be created for each Hypervisor in your Hyper-V cluster.  Each of those Nano Server images should be […]

Leave a Reply

Your email address will not be published. Required fields are marked *