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

<br />
Set-Item WSMan:\localhost\Client\TrustedHosts &quot;192.20.1.7&quot; -Concatenate<br />
#Login to Nano Server<br />
Enter-PSSession -ComputerName 192.20.1.7 -Credential ~\localadmin<br />

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

ps

Create a blob using djoin for offline domain join.

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

create-blob

Copy the djoin blob to nano server

<br />
#Copy the file to nano server<br />
$filePath = 'c:\temp\odjblob'<br />
$fileContents = Get-Content -Path $filePath -Encoding Unicode</p>
<p>$session = New-PSSession -ComputerName 192.20.1.7 -Credential ~\localadmin</p>
<p>Invoke-Command -Session $session -ArgumentList @($filePath,$fileContents) -ScriptBlock {<br />
  param($filePath,$data)<br />
  New-Item -ItemType directory -Path c:\temp<br />
  Set-Content -Path $filePath -Value $data -Encoding Unicode<br />
 }<br />

copy-the-blob

coped-blob-to-nano-server

Add Nano Server to Domain

<br />
#Add Nano Server to Domain<br />
Enter-PSSession -ComputerName 192.20.1.7 -Credential ~\localadmin</p>
<p>djoin /requestodj /loadfile c:\temp\odjblob /windowspath c:\windows /localos</p>
<p>shutdown /r<br />

add-nano-to-domain

Lets see in AD for added computer

ad

, , ,

Post navigation