TechShizz | Tech Guides

Connecting to and Configuring Nano Servers

Before we can connect to a Nano server we need to add it to the trusted hosts list of the server you are connecting from.

Set-Item WSMan:\localhost\Client\TrustedHosts ""

Then to create a new session to the server

$nano - New-PSSession -ComputerName -Credential (Get-Credential)

Next, to join the Nano server to the Domain we need to use the Offline domain join method to create a blob file. This command should be run on the DC, so Exit-PSSession from the session above if still connected.

djoin.exe /provision /domain testlab.local /machine NanoServer1 /savefile .\djoin.blob

Next we need to copy this blob file to the C:\ on the NanoServer1. We can pass this file right into the session variable we made earlier.

Copy-Item -Path .\djoin.blob -DestinationPath C:\ -Tosession $nano

Next we connect back to the nano server to complete the join.

Enter-PSSession -Session $nano

Next we need to complete the join using the blob file on the NanoServer1.

djoin.exe /requestodj /loadfile C:\djoin.blob /windowspath C:\windows /localos

Once complete just reboot the nano server - You should then be able to log onto it with the domain administrator credentials.

Its also good practice to remove the IP from the trusted hosts list that we added earlier like this. 

Set-Item WSMan:\localhost\Client\TrustedHosts ""

Now that the NanoServer1 is a member of the domain, we can now run a remote powershell session to it via it's DNS name like this, and if we're logged in with adminsitrative credentials we dont even need to add the Get-Credential cmdlet.

Enter-PSSession -ComputerName NanoServer1

Installing Packages

To see a list of all Package Providers. These are online repositories that PowerShell can download packages from.


To find what packages a particular provider has run

Find-Package -ProviderName NanoServerPackage

where "nanoserverpackage" is the name of the desired package provider.

Next we need to install the package provider top use it.

Install-PackageProvider NanoServerPackage

Once installed we need to Import the Package Provider, like importing a module but it's a different command. 

Import-PackageProvider NanoServerPackage

Next in this example we want to install the storage package. Using the above commands to find this we should be able to run

Install-Package -Name Microsoft-NanoServer-Storage-Package

A reboot will be required.

Once rebooted we can connect to and manage this Nano server from Server Manager simply by adding it like any other server. 

Installing Nano Servers

To install a Nano server we need the Server 2016 ISO mounted and attached to the HV Host. we then run a series of PowerShell commands to installed the Nano Server.

#Import Nano server PS Module
Import-Module D:\NanoServer\NanoServerImageGenerator

#Create a basic NanoServer VHDX
New-NanoServerImage -MediaPath D: -BasePath .\Base -TargetPath .\NanoServer1.vhdx -DeploymentType Guest -Edition Datacenter -ComputerName NanoServer1 -AdministratorPassword (ConvertToSecureString -String 'Pa$$w0rd' -AsPlainText -Force)

#Create and Start the VM
New-VM -Name NanoServer1 -VHDPath .\NanoServer1.vhdx -MemoryStartupBytes 1GB -Generation 2 | Start-VM

#Begin Remote PowerShell session
Enter-PSSession -VMName NanoServer1

We can run the following to create a Nano Server with features already installed

#Import Nano server PS Module
Import-Module D:\NanoServer\NanoServerImageGenerator

#Create a NanoServer VHDX
New-NanoServerImage -MediaPath D: -BasePath .\Base -TargetPath .\NanoServer1.vhdx -DeploymentType Guest -Edition Datacenter -ComputerName NanoServer1 -InterfaceNameOrIndex Ethernet -Ipv4Address -Ipv4SubnetMask -Ipv4Gateway -Ipv4Dns ("","") -Package Microsoft-NanoServer-IIS-Package -AdministratorPassword (ConvertToSecureString -String 'Pa$$w0rd' -AsPlainText -Force)

#View available packages
Get-NanoServerPackage -MediaPath D:

#create and start the VM
New-VM - Name NanoServer1 -VHDPath .\NanoServer1.vhdx -MemoryStartupByte 1GB -SwitchName vSwitch -Generatino 2 | Start-VM

#Start remote PS Session
Enter-PSSession -NMName NanoServer1


Remember, there is a GUI tool for this that can be downloaded at




Migrating Server Roles with SmigDeploy

Get-WindowFeature - Name migration

Install-WindowsFeature -Name migration

cd \windows\system32\servermigrationtools

.\smigdeploy.exe /package /architecture /amd64 /os WS12R2 /path C:\Migration

#copy the Smig files to the Source Machine
Copy-Item -Path C:\Migration\SMT_ws12r2_amd64 -Destination \\srv2012-lab\c$\Migration

.NET 3.5 is required on the source machine for this to work, so the first step (if it is not already installed) is to install it.

#Check is .NET3.5 is installed
Get-WindowsFeature -Name net-framework-core

#Install .NET 3.5 if required. You will need a 2012R2 ISO mounted for the source files

Install-WindowsFeature net-framework-core -source D:\sources\sxs

#Import smig cmdlets into session
Add-PSSnapin Microsoft.Windows.ServerManager.Migration

#Stop DHCP (the role we're migrating)
Stop-Service -Name DHCP

#View roles and features eligible for migration

#Export the migration data
Export-SmigServerSetting -FeatureID DHCP -Path c:\migration\DHCPMigration -verbose

#Finally copy this exported data back over to the target server
Copy-Item -Path C:\migration\DHPCMigration -Destination \\srv2016-lab\c$\migration

Back over on the Target server we now need to Import the settings

#Import smig cmdlets into session
Add-PSSnapin Microsoft.Windows.ServerManager.Migration

#Install DHCP role and import settings
Import-SmigServerSetting -FeatureID DHCP -Path C:\migration\DHCPMigration -verbode -force


Using DISM to convert Server 2016 Evaluation License to a normal License


We have a copy of server 2016 installed on an evaluation license and we want to license it with our company license. Datacenter edition of Server 2016 is required to do this conversion.


We can use the Automatic Virtual Machine Activation keys to convert the license. We use DISM to convert the license like this:

dism /online /Set-Edition:ServerStandardCor /ProductKey:C3RCX-M6NRP-6CXC9-TW2F2-4RHYD /AcceptEula

See More on Automatic Virtual Machine Activation

AVMA keys

The following AVMA keys can be used for Windows Server 2012 R2.

Edition AVMA key
Datacenter Y4TGP-NPTV9-HTC2H-7MGQ3-DV4TW
Essentials K2XGM-NMBT3-2R6Q8-WF2FK-P36R2

The following AVMA keys can be used for Windows Server 2016.

Edition AVMA key
Standard C3RCX-M6NRP-6CXC9-TW2F2-4RHYD
Essentials B4YNW-62DX9-W8V6M-82649-MHBKQ

Configure Remote Server Management via PowerShell


We have two servers, server1 and server2.

Server1 is a DC and Server2 is a web server. We want to be able to use the IIS management console to administer Server2 from Server1.

To allow remote management of a server role we need to enable the via PowerShell. Below is an example for enabling the management of IIS.

First we need to modify the registry to allow the connection and then we need to set the server "WMSVC" to startup automatically. After the two comands below have been run from Server2, you can then add server2 via the IIS Management Console on Server1. 

Set-ItemProperty -Path "HKLM:\Software\Microsoft\WebManagement\Server" -Force -Restart
Set-Service WMSVC -StartupType Automatic