Saturday, January 28, 2017

Adding a Windows Nano server to the domain

In my previous article, I created a Nano server image. This one is about adding the Nano server to a domain. Adding Nano servers to a domain isn't a pretty little single cmdlet like many others are, but consists of a list of things to do:

  • Configure DNS on the Nano server
  • Create what's called a blob file on a DC (or a machine that is joined to the domain, and a user that has rights to add a computer to the domain or as a Domain admin user)
  • Copy the file over to the Nano server
  • Use the blob file to add the server to the domain
  • Reboot
I've found the following code on site, with an ingenious way to copy the blob file over. If you have the Storage package installed, you can of course just copy it using a share like \\nanosrv1\c$

#Set dns for Nano server
netsh interface ip set dnsservers name="Ethernet" static primary

#Create domain blob file
djoin.exe /provision /domain /machine nanosrv1 /savefile c:\temp\odjblob

#get file over to nano server, needs trustedhosts first
Set-Item WSMan:\localhost\Client\TrustedHosts  "" -Concatenate

#trick from
#to copy the blob over to the target server
$filePath = 'c:\temp\odjblob'
$fileContents = Get-Content -Path $filePath -Encoding Unicode
$session = New-PSSession -ComputerName -Credential nanosrv1\username
Invoke-Command -Session $session -ArgumentList @($filePath,$fileContents) -ScriptBlock {
    New-Item -ItemType directory -Path c:\temp
    Set-Content -Path $filePath -Value $data -Encoding Unicode

#Now add the nano to the domain with the blobfile
djoin /requestodj /loadfile c:\temp\odjblob /windowspath c:\windows /localos
shutdown /r

It is a bit convoluted, but once you get the hang of it, it is doable..


  1. It's really sufficiently worth for me. As I would see it, if all website admins and bloggers made great substance as you did,
    product details

  2. I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us. website laten maken weert

  3. I wanted to thank you for this excellent read!! I definitely loved every little bit of it. I have you bookmarked your site to check out the new stuff you post. webdesign weert

  4. 30 a long time ago, web hosting service with shared server hosting was quite typical inside website hosting industry, people found shared website hosting best ark survival server hosting

  5. I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own Blog Engine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it. cheap rdp

  6. Excellent .. Amazing .. I’ll bookmark your blog and take the feeds also…I’m happy to find so many useful info here in the post, we need work out more techniques in this regard, thanks for sharing.

  7. When a blind man bears the standard pity those who follow…. Where ignorance is bliss ‘tis folly to be wise….

  8. I like viewing web sites which comprehend the price of delivering the excellent useful resource free of charge. I truly adored reading your posting. Thank you! windows 10