How to Join a Nano Server to a Domain

Author by Concurrency Blog

Is there an easy way to join Nano server to the domain like a normal server?  No but it isn't necessarily harder either.  Remember when I said you can configure Nano Server in one line of code? That is actually when you can join your Nano server to the domain.  You can join them after they have been created but it is much more efficient to join them during VHDX creation process.

 

Requirements

Another machine that is already joined to the domain

 

Get the BLOB file!

From the machine that is already joined to the domain, open command prompt as an administrator.

 

CMD> Djoin.exe /provision /domain <domain name> /Machine <destination machine Name> /savefile .\blob

Example

Djoin.exe /provision /domain contoso.com /machine NanoServerABC /savefile c:\temp\blobNanoABC

 

Join Domain during VHDX creation

So now the blob file has been created time to join it to the domain.  During the creation add this option "-DomainBlobPath"

 

Example

New-NanoServerImage -Edition Standard -DeploymentType host -MediaPath  c:\tp5 -BasePath C:\Users\<UserName>\Desktop\Nanoserver\NanoServerImageGenerator\Base -TargetPath C:\TEMP\NanoServer\NanoServerABC.vhdx -OEMDrivers -storage -compute -clustering -DomainBlobPath c:\temp\blobABC

 

Notice: it does not have computer name option anymore during the VHDX creation process?  This is because it has been specified in the blob file.  It's not the end of the world if you had added, it just will prompt you to take it out.

 

Join Domain After VHDX creation

You can mount VHDX and transfer the blob file over to it then run the following code on it.

 

djoin /requestodj /loadfile <blob location> /windowspath c:\windows /localos

shutdown /r /t 5

Exit-PSSession

example

djoin /requestodj /loadfile c:\temp\odiblob /windowspath c:\windows /localos
shutdown /r /t 5

Exit-PSSession

 

But wait  I can't mount my VHDX for whatever reason. Out of the box you can't map the Nano server drive nor ping it.  So this one is a bit more tricky.

 

On the Nano Server

 

//import module

Import-Module NetSecurity

 

//to allow SMB Sharing

Set-NetFirewallRule -DisplayGroup “File And Printer Sharing” -Enabled True

 

Now on another machine just open a File explorer and type in \\<NanoServerABC>\C$.  You should be able to transfer and place the Blob file there then just run the same code as above.

 

djoin /requestodj /loadfile <blob location> /windowspath c:\windows /localos

shutdown /r /t 5

Exit-PSSession

 

Now that we have gone through the essentials let's make this more interesting.  Next we will go into Hyper converge Nano Server with Storage Spaces Direct. 

Author

Concurrency Blog

The latest about Concurrency