VMware + Windows Nano Server = How to build them?

Recently I have been doing some research on Windows Server 2016 Technical Preview 3 Nano Server on VMware ESXi Hypervisor and I can hardly find any online article that demonstrate it. After much experimenting with a few builds, I have decided to share this knowledge out on Microsoft TechNet Wiki.

You can either view this article from the Microsoft TechNet Wiki which may have any improvement updates by the TechNet community on the link below;

Or carry on reading this page on the original article which I have noted in my engineering journal with some explanations on the process.

 

The Original TechNet Wiki Article on VMware + Windows Nano Server = How to build them?

Introduction

Have you heard of the new awesome Microsoft Windows Nano Server? I discovered that most of the built articles are revolving on physical hardware, Hyper-V and not forget, Azure. If your hypervisor environment is using VMware vSphere, those may just slightly miss the bandwagon to test Nano Server in their environment. Well, this article is going to change the game play a bit because I want to test it out on vSphere 6.0 and cannot just let the Hyper-V hypervisor have all the fun.

Other Hypervisor Articles;

So this article will be VMware + Windows Nano Server. Let us begin the journey.

 

Preparation for Nano Server Image

At the time of creating this article, we will be focusing on Windows Server 2016 Technical Preview 3.

Where is the NanoServer content?

The NanoServer folder reside in the Windows Server 2016 Technical Preview DVD Media.

Where do I start?

Copy the NanoServer folder from the media to the local drive using PowerShell.

# Find out the CD-ROM Drive Letter
Get-Volume | `
    ?{$_.DriveType -eq "CD-ROM"} ;
# Copy the NanoServer folder from the Windows Server 2016
# Technical Preview 3 DVD media
Copy-Item `
    -Path Z:\NanoServer `
    -Destination C:\ `
    -Recurse `
    -Verbose ;

VMware + Windows Nano Server - Build Process 1 - Copy NanoServer content

 

Preparation for VMware Tools Drivers

This section focuses on extracting VMware Tools in preparation to slipstream the mandatory drivers. If you are struggling with this, you may want to collaborate with your VMware evangelist and work together.

Where is the VMware Tools for Windows media located?

SSH to VMware vSphere ESXi 6.0 Host using PuTTY.

ls -l vmimages/tools-isoimages/win*

VMware + Windows Nano Server - Build Process 2 - Find VMware Tools for Windows ISO media file

Download the vmimages/tools-isoimages/windows.iso file using WinSCP to the machine for content extraction

If your machine is also a VMware virtual machine, you can manually mount the ISO by following the article below;

 

How do I extract VMware Tools content from the ISO media file?

This is how to extract the VMware Tools content using the ISO Media with VMware Tools Installation Wizard to the destination folder below using PowerShell.

# Create a VMware_Tools_Extracted folder for extracting
# VMware Tools installation content
New-Item `
    -Path C:\NanoServer\VMware_Tools_Extracted `
    -Type directory ;
# Mount the Windows VMware Tools ISO
Mount-DiskImage `
    -ImagePath C:\windows.iso ;
# Find the mounted Windows VMware Tools ISO Drive Letter
(Get-DiskImage -ImagePath C:\windows.iso | Get-Volume).DriveLetter
# Execute VMware Tools Setup64.exe and extract the content to
# C:\NanoServer\VMware_Tools_Extracted folder using the
# Installation Wizard
<# Mounted Windows VMware Tools Drive Letter #>:\setup64.exe /a /p C:\NanoServer\VMware_Tools_Extracted
# Eg. d:\setup64.exe /a /p C:\NanoServer\VMware_Tools_Extracted

VMware + Windows Nano Server - Build Process 3 - Extract VMware Tools Installation Media Content

Unfortunately, the VMware Tools command will prompt the VMware Tools Installation Wizard graphical user interface and therefore it cannot be scripted. User intervention on the graphical user interface is required to complete the extraction to the destination folder as shown on the screenshots below;

  1. Select Next
    VMware + Windows Nano Server - Build Process 3.1 - VMware Tools Installation Wizard
  2. Select Destination Folder
    VMware + Windows Nano Server - Build Process 3.2 - VMware Tools Installation Wizard
  3. Select Finish
    VMware + Windows Nano Server - Build Process 3.3 - VMware Tools Installation Wizard

Once the VMware Tools Installation Wizard has completed the extraction to the destination folder, remember to dismount the VMware Tools ISO media using the PowerShell.

# Dismount the Windows VMware Tools ISO
Dismount-DiskImage `
    -ImagePath C:\windows.iso ;

VMware + Windows Nano Server - Build Process 3.4 - Dismount the VMware Tools ISO Media

 

How do I extract VMware Tools content from manually mounted ISO image?

Create a folder to contain the extracted VMware Tools content using PowerShell.

# Create a VMware_Tools_Extracted folder for extracting
# VMware Tools installation content
New-Item `
    -Path C:\NanoServer\VMware_Tools_Extracted `
    -Type directory ;

If your machine is also a VMware virtual machine and you have already mounted the VMware Tools ISO image, you can extract the VMware Tools content by following the article below;

Extract the content into the destination folder using the VMware Tools Installation Wizard graphical user interface and unmount the ISO image.

 

What VMware Tools drivers should I include in NanoServer?

Before we prepare the VMware Tools drivers to be included in NanoServer, I like to be a bit tidy in containing what I need in a separate folder so that I don’t get confuse. Create a VMware Drivers folder within the parent NanoServer folder using PowerShell.

# Create a VMware Drivers folder
New-Item `
    -Path C:\NanoServer\VMware-Drivers `
    -ItemType directory ;

Selecting the VMware drivers required for NanoServer as a guest virtual machine is very important. In order to understand what are those from the documentation link below;

# Copy VMware Tools Memory Control Driver - This driver is Mandatory
Copy-Item `
    -Path 'C:\NanoServer\VMware_Tools_Extracted\VMware\VMware Tools\VMware\Drivers\memctl\*' `
    -Destination C:\NanoServer\VMware-Drivers `
    -Recurse `
    -Verbose ;

# Copy VMware Tools Paravirtual SCSI (PVSCSI) Drivers - Optional
Copy-Item `
    -Path 'C:\NanoServer\VMware_Tools_Extracted\VMware\VMware Tools\VMware\Drivers\pvscsi\*' `
    -Destination C:\NanoServer\VMware-Drivers `
    -Recurse `
    -Verbose ;

# Copy VMware Tools SVGA 3D Video (SVGA) Drivers - Optional
Copy-Item `
    -Path 'C:\NanoServer\VMware_Tools_Extracted\VMware\VMware Tools\VMware\Drivers\video_wddm\*' `
    -Destination C:\NanoServer\VMware-Drivers `
    -Recurse `
    -Verbose ;

# Copy VMware Tools Virtual Machine Communication Interface (VMCI)
#  Drivers - Optional
Copy-Item `
    -Path 'C:\NanoServer\VMware_Tools_Extracted\VMware\VMware Tools\VMware\Drivers\vmci\device\*' `
    -Destination C:\NanoServer\VMware-Drivers `
    -Recurse `
    -Verbose ;

# Copy VMware Tools VMXNet NIC (VMXNET3) Drivers - This 
#  driver is Mandatory for using VMXNET3 Network Interface.
Copy-Item `
    -Path 'C:\NanoServer\VMware_Tools_Extracted\VMware\VMware Tools\VMware\Drivers\vmxnet3\NDIS6\*' `
    -Destination C:\NanoServer\VMware-Drivers `
    -Recurse `
    -Verbose ;

VMware + Windows Nano Server - Build Process 3.5 - Copy VMware Tools Drivers

 

Getting Started with Nano Server Creation

With Windows Server 2016 Technical Preview 3, Microsoft has simplified the Nano Server creation with 2 PowerShell scripts that we have copied across to the local drive during the preparation for Nano Server image and we will use them in the example below.

Firstly, we need to ensure that we are at the working folder where the New-NanoServerImage PowerShell script is located. The reason is that if you are not in that working folder, you may encounter errors when the script is going to invoke the Convert-WindowsImage PowerShell script written by Pronichkin.

# Ensure you are at C:\NanoServer working folder
Set-Location `
    -Path C:\NanoServer ;

Secondly, we will have to import the New-NanoServerImage PowerShell script module using PowerShell.

# Import New-NanoServerImage PowerShell Module
Import-Module `
    -Global C:\NanoServer\new-nanoserverimage.ps1 ;

Next, we will create a basic NanoServer image with no role or feature except for the basic necessities. For a more detail documentation of how to create a NanoServer, you can read up more from the link below;

We need to ensure that -GuestDrivers parameter is included to allow you to have keyboard functionality when you launch the remote console using VMware vSphere 6.0 Web Client.

Remember the VMware Tools drivers that we have extracted and copied to another destination folder just now? We will need to include the -DriversPath parameter and specify the copied VMware drivers folder path.

Using the PowerShell command, we will concatenate those parameters into a single command to initiate the creation of a new basic Nano Server.

# Create New Basic NanoServer Image
New-NanoServerImage `
    -MediaPath Z: `
    -BasePath C:\NanoServer\Base `
    -TargetPath C:\NanoServer\NanoServer `
    -ComputerName NanoServer `
    -EnableRemoteManagementPort `
    -Language 'en-us' `
    -GuestDrivers `
    -DriversPath C:\NanoServer\VMware-Drivers `
    -AdministratorPassword (ConvertTo-SecureString -String "Password" -AsPlainText -Force) ;

VMware + Windows Nano Server - Build Process 4 - Create NanoServer

Done. We have a Nano Server created on a Generation 1 VHD virtual disk that can be mounted and boot up on a Hyper-V host. If you have included the VMware Paravirtual SCSI (PVSCSI) Drivers, you definitely can boot it up on your VMware vSphere ESXi 6.0 host provided that your virtual machine is using PVSCSI controller for the VMDK disk. But… Firstly, we generally prefer LSI SAS controller for Windows. Secondly, how do you get it running in vSphere?

 

Injecting LSI SAS storage driver into Nano Server

First of all, we need to find the LSI SAS storage controller driver folder path within a Windows Operating System since it is a Microsoft driver.

# Find lsi_sas.sys Storage Driver
Get-ChildItem `
    -Path C:\Windows\System32\DriverStore `
    -Filter lsi_sas.sys `
    -Recurse ;

Next, we need to create an empty moundir folder for DISM to mount the VHD.

# Create a MountDir folder for Deployment Image Servicing and Management (DISM)
New-Item `
    -Path C:\NanoServer\mountdir `
    -ItemType directory ;

Next, we use DISM to mount the NanoServer VHD into the mountdir folder.

# Mount NanoServer.vhd vDisk on C:\MountDir folder
dism /mount-image /imagefile:c:\nanoserver\nanoserver\nanoserver.vhd /index:1 /mountdir:c:\nanoserver\mountdir

Once we done that, we can inject the LSI SAS storage controller driver by specifying the folder path.

# Add the lsi_sas.sys storage controller driver into C:\MountDir folder
dism /add-driver /image:c:\nanoserver\mountdir /driver:C:\Windows\System32\DriverStore\FileRepository\lsi_sas.inf_amd64_2bd0ac9c0d7785b0

After that, we dismount the mountdir folder.

# Unmount NanoServer.vhd vDisk from C:\MountDir folder
dism /unmount-image /mountdir:c:\nanoserver\mountdir /commit

VMware + Windows Nano Server - Build Process 5 - Inject LSI SAS Driver into NanoServer

Once this is performed, the Nano Server will be able to boot up on LSI SAS storage controller with VMDK disk attached. We can also safely regard this NanoServer.vhd is the new base image for your VMware environment although I haven’t shown you how to get it into the vSphere 6.0 yet.

 

Adding role or feature over the existing Nano Server VHD

Alright, a Nano Server without any role or feature will not be of any use to anyone. Since we currently have a proper NanoServer.vhd base image, we can use the new base image to recreate another Nano Server VHD with roles or feature.

Let’s find out the full path of our base image that we created just now.

# Verify the existing NanoServer VHD Path
Get-ChildItem `
    -Path C:\NanoServer\NanoServer\ | `
    Select `
    FullName, `
    Length ;

In this process of adding a Hyper-V role, we included the -Compute parameter on the PowerShell command. This will instruct it to include the Microsoft-NanoServer-Compute-Package.cab file during repackaging. We also need to include the -ExistingVHDPath parameter and specify our existing base image full path.

For a full reference of the available Nano Server role and feature included in Windows Server 2016 Technical Preview 3, you can find them in the link of the documentation below;

# Create a New NanoServer with Hyper-V role
# using existing NanoServer Base Image
New-NanoServerImage `
     -MediaPath Z: `
     -BasePath C:\NanoServer\Base `
     -TargetPath C:\NanoServer\NanoServer-Compute `
     -ExistingVHDPath C:\NanoServer\NanoServer\NanoServer.vhd `
     -ComputerName NanoServer `
     -Compute `
     -EnableRemoteManagementPort `
     -Language 'en-us' `
     -GuestDrivers `
     -AdministratorPassword (ConvertTo-SecureString -String "Password" -AsPlainText -Force) ;

Once this is completed, you will notice that the new NanoServer-Compute.vhd has a different file length size now. It is slightly bigger than the base image.

# Verify the new NanoServer with Hyper-V role VHD Path
Get-ChildItem `
    -Path C:\NanoServer\NanoServer-Compute\ | `
    Select `
    FullName, `
    Length ;

VMware + Windows Nano Server - Build Process 6 - Adding Compute Role over NanoServer base image

 

Getting Started with Nano Server Disk Footprint

Since we have found out that adding a role or feature increases the NanoServer-Compute.vhd file size, we need to find out the actual size of our VHD because it represent the hard disk size of the Nano Server operating system volume.

# Get the NanoServer-Compute.vhd current default disk size information
Get-VHD `
    -Path C:\NanoServer\NanoServer-Compute\NanoServer-Compute.vhd | `
    Select `
        @{L='Path';E={$_.Path}}, `
        VhdFormat, `
        VhdType, `
        @{L='FileSize in Byte';E={$_.FileSize}},`
        @{L='FileSize in KB';E={$_.FileSize/1KB}}, `
        @{L='FileSize in MB';E={$_.FileSize/1MB}}, `
        @{L='FileSize in GB';E={$_.FileSize/1GB}}, `
        @{L='Size in Byte';E={$_.Size}}, `
        @{L='Size in GB';E={$_.Size/1GB}}, `
        @{L='MinimumSize in Byte';E={$_.MinimumSize}}, `
        @{L='MinimumSize in GB';E={$_.MinimumSize/1GB}}, `
        FragmentationPercentage ;

VMware + Windows Nano Server - Build Process 7 - Getting VHD Information

By default using New-NanoServerImage command in Windows Server 2016 Technical Preview 3, the Nano Server will be created with Generation 1 VHD in Dynamic VHD Type with 40GB disk partition containing about ~461MB of files. For VMware enthusiasts, it means 40GB Thin Provisioned Disk with about ~461MB consumed space for files.

 

How to reduce Nano Server 40GB VHD to 4GB VHD?

True, Nano Server is indeed very small and it can be less than 1GB depending on how many drivers, roles or features has been included in the built. But do we really need 40GB Dynamic VHD? I do not have an answer for it. But the process below demonstrates on how to reduce the disk from 40GB to less than 4GB to fit into a 4GB VMDK.

Firstly, we need to convert the Nano Server Generation 1 VHD to a Generation 2 VHD.

# Convert the NanoServer-Compute.vhd Generation 1 VHD to
# NanoServer-Compute.vhdx Generation 2 VHDX format
Convert-VHD `
    -Path C:\NanoServer\NanoServer-Compute\NanoServer-Compute.vhd `
    -DestinationPath C:\NanoServer\NanoServer-Compute\NanoServer-Compute.vhdx `
    -VHDType Dynamic `
    -DeleteSource ;

Prior to resizing, we will get the current disk information of the VHDX to prove that the resizing has performed according to plan.

# Get the new NanoServer-Compute.vhdx current default disk size
#  information
Get-VHD `
    -Path C:\NanoServer\NanoServer-Compute\NanoServer-Compute.vhdx | `
    Select `
        @{L='Path';E={$_.Path}}, `
        VhdFormat, `
        VhdType, `
        @{L='FileSize in Byte';E={$_.FileSize}},`
        @{L='FileSize in KB';E={$_.FileSize/1KB}}, `
        @{L='FileSize in MB';E={$_.FileSize/1MB}}, `
        @{L='FileSize in GB';E={$_.FileSize/1GB}}, `
        @{L='Size in Byte';E={$_.Size}}, `
        @{L='Size in GB';E={$_.Size/1GB}}, `
        @{L='MinimumSize in Byte';E={$_.MinimumSize}}, `
        @{L='MinimumSize in GB';E={$_.MinimumSize/1GB}}, `
        FragmentationPercentage ;

Next, we mount the VHDX locally and get the virtual disk internal volume information to verify the volume structure is correct as stated before any manipulation made.

# Mount the NanoServer-Compute.vhdx and get the NanoServer
# system drive partition volume size
Mount-VHD `
    -Path C:\NanoServer\NanoServer-Compute\NanoServer-Compute.vhdx `
    -Passthru | `
    Get-Disk | `
    Get-Partition | `
    Get-Volume ;

VMware + Windows Nano Server - Build Process 8 - Convert VHD to VHDX and Mount the VHDX

By default, the New-NanoServerImage.ps1 PowerShell Module utilise the Convert-WindowsImage.ps1 PowerShell Module to create the VHD vDisk with the default size value of 40GB and the default size of 40GB may not fit into a USB Flash Thumb Drive if your solution implementation required although it is a Dynamic VHD Type.

With the VHD being mounted, we can start resizing the VHD virtual disk internal partition.

# Resize the Partition inside Generation 2 VHD
Resize-Partition `
       -DriveLetter D `
       -Size (((4GB - ((512KB * 2) + (512KB * 2))) - 300MB ) - 600MB) ;

Well, it is arguable that the Disk Size in GB is going to be far less than 4GB and that is because;

  1. We reduced 1024KB for VHD Header and 1024KB VHD Footer to align the space to fit into 4GB VMDK
  2. We reduced 300MB for System Reserved partition for Boot Manager code and Boot Configuration Database
  3. We reduced 600MB from the Partition and VHD to provide free working space on the VMDK for the expansion of the attached VHD vDisk during boot up.

Next, we dismount the VHD vDisk from the local machine to resize the VHD.

# Dismount the NanoServer-Compute.vhdx Generation 2 VHD
Dismount-VHD `
       -Path C:\NanoServer\NanoServer-Compute\NanoServer-Compute.vhdx ;

Once the VHD has been dismounted, the VHD file will not be locked and we can start resizing the VHD.

# Resize the NanoServer-Compute.vhdx Generation 2 VHD
Resize-VHD `
       -Path C:\NanoServer\NanoServer-Compute\NanoServer-Compute.vhdx `
       -ToMinimumSize ;

After the VHD has been resized, we can start converting the Generation 2 VHD back to Generation 1 VHD to keep consistent file type with the script output.

# Convert the NanoServer-Compute.vhdx Generation 2 VHD back
# to NanoServer-Compute.vhd Generation 1 VHD format
Convert-VHD `
       -Path C:\NanoServer\NanoServer-Compute\NanoServer-Compute.vhdx `
       -DestinationPath C:\NanoServer\NanoServer-Compute\NanoServer-Compute.vhd `
       -VHDType Dynamic `
       -DeleteSource ;

Now the moment of truth, we will obtain the VHD information and verify it has been reduced in size.

# Get the new NanoServer.vhd current default disk size information
Get-VHD `
    -Path C:\NanoServer\NanoServer-Compute\NanoServer-Compute.vhd | `
    Select `
        @{L='Path';E={$_.Path}}, `
        VhdFormat, `
        VhdType, `
        @{L='FileSize in Byte';E={$_.FileSize}},`
        @{L='FileSize in KB';E={$_.FileSize/1KB}}, `
        @{L='FileSize in MB';E={$_.FileSize/1MB}}, `
        @{L='FileSize in GB';E={$_.FileSize/1GB}}, `
        @{L='Size in Byte';E={$_.Size}}, `
        @{L='Size in GB';E={$_.Size/1GB}}, `
        @{L='MinimumSize in Byte';E={$_.MinimumSize}}, `
        @{L='MinimumSize in GB';E={$_.MinimumSize/1GB}}, `
        FragmentationPercentage ;

VMware + Windows Nano Server - Build Process 9 - Resize Partition & VHD and Convert VHDX to VHD

Now we have Nano Server with Hyper-V role that is less than 4GB in VHD which can fit into a 4GB VMDK, but it is still in a VHD format for Hyper-V Host and we need to get it hosted within a vSphere ESXi host.

 

Getting Started with Nano Server deployment in vSphere ESXi

Before we start, we will have to ensure that have created a Virtual Machine on vSphere ESXi host with the correct virtual hardware specification where the Nano Server image will boot up from. We will also requires a Windows Preinstallation Environment (WinPE) to boot up and perform some system preparation configuration on the Virtual Machine.

What is the requirement?

We will need to download and install the Windows Assessment and Deployment Kit (ADK) for Windows 10 and install the Windows Preinstallation Environment (Windows PE) feature to allows us to create a Windows PE image.

To obtain Windows Assessment and Deployment Kit (ADK) for Windows 10, you can download it from the link below; http://go.microsoft.com/fwlink/p/?LinkId=526740

 

Preparing Nano Server VHD using Windows PE for vSphere ESXi

With all the preparation of the Nano Server VHD completed, we will need to prepare a media to boot into Windows Preinstallation Environment with our Nano Server VHD file. This is because we cannot mount the VHD file type into the Guest Virtual Machine on ESXI using vSphere 6.0 Web Client.

Let’s jump into the Windows Assessment and Deployment environment now.

# Enter into the Windows Assessment and Deployment
# Kit (ADK) environment from PowerShell console
C:\Windows\system32\cmd.exe /k "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\DandISetEnv.bat"

Use the command script provided in that environment to copy the Windows PE media content.

# Copy the Windows Preinstallation Environment (WinPE)
# media content for amd64 into your working folder
"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\copype.cmd" amd64 "C:\NanoServer\WindowsPE AMD64 - Windows Server 2016 TP3 - Nano Server"

VMware + Windows Nano Server - Build Process 10 - Copy Windows PE amd64 media content to NanoServer folder

Let’s exit the ADK environment into PowerShell environment.

# Return back to PowerShell Console
PowerShell

We will have to manually create an empty VHD folder within the Windows PE media folder to keep our Nano Server VHD file.

# Create a VHD folder in Windows PE Media Folder
New-Item `
    -Path "C:\NanoServer\WindowsPE AMD64 - Windows Server 2016 TP3 - Nano Server\media\VHD" `
    -Type directory ;

Copy the Nano Server VHD file to that newly create VHD folder in the Windows PE media folder. It has to be in the media folder so that the file will be included when we compile it into an ISO image.

# Copy NanoServer-Compute.vhd vDisk to Windows PE
#  Media VHD Folder
Copy-Item `
    -Path C:\NanoServer\NanoServer-Compute\NanoServer-Compute.vhd `
    -Destination "C:\NanoServer\WindowsPE AMD64 - Windows Server 2016 TP3 - Nano Server\media\VHD" `
    -Recurse `
    -Verbose ;

Let’s return back to the ADK environment to use another command script for compiling to ISO image.

# Return back into the Windows Assessment and Deployment
# Kit (ADK) environment from PowerShell console
C:\Windows\system32\cmd.exe /k "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\DandISetEnv.bat"

Using the command script, we begin the compilation by specifying the Windows PE folder and the ISO Image file destination path.

# Create the Windows PE ISO from the Windows PE Media folder
"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\MakeWinPEMedia.cmd" /ISO "C:\NanoServer\WindowsPE AMD64 - Windows Server 2016 TP3 - Nano Server" "C:\NanoServer\NanoServer-Compute\Windows_Server_2016_TP3_-_Nano_Server_for_vSphere_6.0.ISO"

VMware + Windows Nano Server - Build Process 11 - Copy Nano Server VHD to media folder and Create Windows PE ISO

Once you obtained the ISO image file, you will need to mount the ISO image file on the Guest Virtual Machine using vSphere 6.0 Web Client and Power On the Guest VM.

VMware + Windows Nano Server - Build Process 12 - Create a VM and Mount the Windows PE ISO

 

Partitioning the VMDK using DiskPart in Windows PE

Powering On the Guest for the first time with Windows PE, we will automatically boot into Windows PE with a Command Prompt and it will be the interface that we will be using to partition the VMDK.

Firstly, we will use DiskPart to clean the VMDK Disk to ensure that the disk has no volume or partition structure.

:: Clean the Disk 0
diskpart
select disk 0
clean

If you prefer to do this using PowerShell instead of DiskPart within Windows Preinstallation Environment (Windows PE), you will have to follow this guide on how to add PowerShell support into Windows PE prior creating the bootable ISO Image below.

VMware + Windows Nano Server - Build Process 13 - Perform a Disk Clean using DiskPart

Next, we will have to manually create a System Reserved partition to store the Boot file configuration.

:: Create the System Reserved 300MB Partition
create partition primary size=300
format fs=ntfs label="System Reserved" quick
assign letter=s
active

VMware + Windows Nano Server - Build Process 14 - Create System Reserved partition using DiskPart

Next, we will use the remaining free space to create an Operating System partition where the Nano Server VHD file will be located and exit DiskPart.

:: Create the Operating System Partition
create partition primary
format fs=ntfs label="Operating System" quick
assign letter=c
exit

VMware + Windows Nano Server - Build Process 15 - Create Operating System partition using DiskPart

With the Operating System partition created, we will copy the Nano Server VHD file to the Operating System drive.

:: Copy the NanoServer-Compute.vhd from WindowsPE ISO to C:\ Operating System Drive
xcopy D:\VHD\NanoServer-Compute.vhd C:\ /V /F

VMware + Windows Nano Server - Build Process 16 - Copy the VHD from media to local Operating System Drive

Next, we will using DiskPart again to attach the Nano Server VHD file as a vDisk volume.

:: Attach the NanoServer.vhd vDisk using Diskpart
diskpart
select vDisk File=C:\NanoServer-Compute.vhd
attach vDisk
list volume

VMware + Windows Nano Server - Build Process 17 - Attach VHD using DiskPart

To make our life easy, we will assign a drive letter to identify the vDisk volume and exit DiskPart. And this is not the end of it because the attached vDisk volume is still not bootable due to the fact that the System Reserved partition do not have a boot file configuration of this virtual disk volume.

:: Assign a Drive Letter to the NanoServer-Compute.vhd vDisk volume
select volume 3
assign letter=v
exit

VMware + Windows Nano Server - Build Process 18 - Assign a new Drive Letter to the VHD vDisk Volume using DiskPart

Creating the Boot Configuration File using Windows PE

With the vDisk drive letter assigned and exited the DiskPart, we will change to the vDisk drive and navigate to the Windows\System32 folder. We will use the BCDboot tool and specify the source of the boot environment file that requires to be copied to the System Reserved drive.

:: Create boot file on System Reserved drive
V:
cd V:\Windows\System32
bcdboot V:\Windows /s S:

If you are interested in understanding BCDBoot, you can refer to this document link below;

VMware + Windows Nano Server - Build Process 19 - Create the boot file on System Reserved drive

Once the boot files has created successfully, we will return to DiskPart, detach the virtual disk volume and exit everything for an automatic reboot.

:: Detach the vDisk and exit to reboot
diskpart
select vDIsk File=C:\NanoServer-Compute.vhd
detach vDisk
exit
exit

VMware + Windows Nano Server - Build Process 20 - Detach the VHD vDisk and Reboot

 

Having the first look of Nano Server from vSphere Remote Console

After exiting Windows PE environment and reboot automatically, you can view login screen on your Remote Console.

VMware + Windows Nano Server - Build Process 21 - Launch Remote Console and Login using local Administrator credential

After logging into the Nano Server through Remote Console, there is nothing much except text information of the Server Configuration. We cannot do anything in here except for the 4 tasks;
1. Navigate using Up and Down arrows
2. Initiate to Log Off using ESCape button
3. Initiate a Restart or Reboot using ConTroL and F6 button together
4. Initiate a Shut down using ConTrol and F12 button

VMware + Windows Nano Server - Build Process 22 - Viewing Nano Server System Configuration

How to manage the Nano Server remotely?

Since it has no Graphical User Interface and it limited on what we can do in remote console, the most preferred method will be using PowerShell to remotely connect to the Nano Server for any management at this stage.

# Verify if the Nano Server is a Trusted Hosts
Get-Item `
    -Path WSMan:\localhost\Client\TrustedHosts ;

# Set the Nano Server IP Address to be a Trusted Hosts
Set-Item `
    -Path WSMan:\localhost\Client\TrustedHosts `
    -Value 192.168.100.14 `
    -Force ;

# Establish a remote PowerShell Session to the Nano Server
Enter-PSSession `
    -ComputerName 192.168.100.14 `
    -Credential (New-Object `
        -TypeName System.Management.Automation.PSCredential `
        -ArgumentList "192.168.100.14\Administrator", `
        (ConvertTo-SecureString `
            -String "Password" `
            -AsPlainText `
            -Force) `

    ) ;

VMware + Windows Nano Server - Build Process 23 - Remoting to Nano Server using PowerShell