Add Nano Server to Domain

Few days back I was building my SCOM 2016 Lab and I got the idea of monitoring Nano Server, which was introduce with Windows Server 2016. Ok so when I search Azure marketplace I found there is a template to create a nano server.So first I deploy the Nano Server using that template.

Now I got a problem, Nano server is a headless server which you cant RDP or not a command prompt. For Nano Server management we have to use PowerShell or RSAT tools. So as a first step I login to Windows Server 2016 server which stays in the same network and run the PowerShell and execute the following commands.

First add the server to TrustedHost List, Then login to Nano Server

Set-Item WSMan:\localhost\Client\TrustedHosts "" -Concatenate
#Login to Nano Server
Enter-PSSession -ComputerName -Credential ~\localadmin

After Enter the command you can verify it by going to WSMan provider


Create a blob using djoin for offline domain join.

#Create folder to store the blob object
New-Item -ItemType directory -Path c:\temp
djoin.exe /provision /domain /machine NanoServerName /savefile c:\temp\odjblob


Copy the djoin blob to nano server

#Copy the file to nano server 
$filePath = 'c:\temp\odjblob' 
$fileContents = Get-Content -Path $filePath -Encoding Unicode

$session = New-PSSession -ComputerName -Credential ~\localadmin
Invoke-Command -Session $session -ArgumentList @($filePath,$fileContents) -ScriptBlock {
  New-Item -ItemType directory -Path c:\temp
  Set-Content -Path $filePath -Value $data -Encoding Unicode



Add Nano Server to Domain

#Add Nano Server to Domain
Enter-PSSession -ComputerName -Credential ~\localadmin

djoin /requestodj /loadfile c:\temp\odjblob /windowspath c:\windows /localos

shutdown /r


Lets see in AD for added computer