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 "192.20.1.7" -Concatenate
#Login to Nano Server
Enter-PSSession -ComputerName 192.20.1.7 -Credential ~\localadmin

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

ps

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 contoso.com /machine NanoServerName /savefile c:\temp\odjblob

create-blob

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 192.20.1.7 -Credential ~\localadmin
 
Invoke-Command -Session $session -ArgumentList @($filePath,$fileContents) -ScriptBlock {
  param($filePath,$data)
  New-Item -ItemType directory -Path c:\temp
  Set-Content -Path $filePath -Value $data -Encoding Unicode
 }

copy-the-blob

coped-blob-to-nano-server

Add Nano Server to Domain

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

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

shutdown /r

add-nano-to-domain

Lets see in AD for added computer

ad