In this article I’ll show you how to join a Windows Server 2016 Nano Server to a Domain.
You might be Interested In:
- How To Manage Nano Server 2016
- Disable The Firewall On A Windows Nano Server Using PowerShell
- Install Nano Server 2016 PowerShell Package Provider
- Copy Files To A Nano Server Using Remote PowerShell 5
To join the Nano Server to my Active Directory domain I’ll use offline Domain Join utility (Djoin.exe).
To complete this you will need to run the Djoin command from a domain controller or from a member server joined to the domain.
To start the process run the command line below from the command prompt tool:
The command will create a Computer account In AD with the Name NANOSERVER05 and will create a file called NanoServer05 In the location you run the command from.
(change text marked In red)
djoin.exe /provision /domain TEST /machine NANOSERVER5 /savefile .\filename
After you run the command your will see the output below:
And below you will see the file the command created.
Below you will see the content of the file.
Once you have the file copy it to the Nano Server C:\ Drive using File Explorer \\nanoserver\c$
Once the file Is copied to the Nano Server open a PowerShell and connect to the Nano server using the lines below:
(Note: Change the IP address to the Nano IP address)
The line below will add the Nano Server IP address to the Trusted Host List:
Set-Item WSMan:\localhost\Client\TrustedHosts -Value 192.168.100.20 -Concatenate
Line below will create a PowerShell session to the Nano Server:
Enter-PSSession -ComputerName 192.168.100.20 -Credential Administrator
Once you logged on, Run the line below:
djoin /requestodj /loadfile c:\nanoserver05 /windowspath c:\windows /localos
Done, The Nano Server Is now Part of the DC, you can restart the Nano server log in to the domain.
7 responses to “Join Windows Server 2016 Nano Server To A Domain”
I used the Powershell below to copy the blog-file to the nano server to bypass firewall blocking SMB (\nanoserverc$ did not work for me).
$Session = New-PSSession -ComputerName $IPAddress -Credential $Credential
Copy-Item -ToSession $Session -Path .nanoserver.txt -Destination “c:”
Also this way you can create an entire script that runs on its own 😀
Hi, thanks for the tutorial. When attempting to run djoin /requestodj I got the following error:
[192.168.75.178]: PS C:\Users\Administrator\Documents> djoin /requestodj /loadfile c:\temp\odjblob /windowspath %systemroot% /localos
Loading provisioning data from the following file: [c:\temp\odjblob].
The offline domain join request failed: 0xa9d.
Unable to load the specified offline registry hive. Please ensure you have access to the specified path location and permissions to modify
its contents. Running as an elevated administrator may be required.
I’m already logged in as local Administrator on the nano server. Have you came across this?
Hi Mark I have the same issue are you. Did you ever find a solution to this?
Solution Found: You need to include –%
djoin –% /requestodj /loadfile c:\temp\odjblob /windowspath %systemroot% /localos
-% is showing as an invalid option for djoin; could you elaborate on what the -% option did in your environment?
I only entered one dash when I see it should have been *two* before the percentage sign.
thanks so much worked a treat no issues but one as I forgot to rename the hostname to what I created also the IP address but once I correct that in the PS Scripts it all worked fine, thank so much. I used Nano Server Image builder to create my original Nano Server VHD then added to my newly created VM and made sure all the WimRM, RDP and firewall settings were set to allow before undertaking the AD part. Brilliant thank so much.