Good day All,
Welcome back!!!
Windows 2008 gave birth to Server core a small footprint of Windows 2008 OS and with Windows 2012 we where able to move from Server Core to Minimal Server Interface to Full GUI Windows 2012.
With Windows 2016 MS gave birth to Nano Servers a small footprint of a Windows OS,VM guys can say it as similar to ESXi but we all will be surprised to see a Windows OS just about 700MB, so hard to believe it right? :)
see the below screen shot to believe it - Probably the max size i would say.. i have included almost all Roles and Features. If this Nano Server serve has only DNS or Hyperv or Clustering probably image size would be around 600 MB
Lets go over the steps to setup you first Nano Servers:
1. Mount your Windows 2016 Technical Preview 4 ISO
2.Copy the contents from folder named NanoServer on to some drive , Lets say C:\Nanoserver
3.
Open Powershell in Administrator Mode and run the following Commands
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force -Confirm:$false
Change the Path to the foler you copied that nanoserver scripts from ISO.
Import-Module .\nanoServerImageGenerator.psm1 -verbose
New-NanoServerImage -MediaPath H:\ -BasePath .\Base -TargetPath C:\NanoServer\NANO2016A.vhd -ComputerName NANO2016A -OEMDrivers –Compute -Clustering -Storage
Note: The below screen shot taken from MS article tells in detail what are the various Roles and Features you can add to a Nano Server.
Note: H drive is where my Windows 2016 ISO mounted.
when done you will see a vhd in the location targetpath you specified, in my case its c:\NanoServer
update the vhd with Guest drivers too for Hyper v
Edit-NanoServerImage -BasePath .\Base -TargetPath C:\NanoServer\NANO2016A.vhd -GuestDrivers
4.
Create a Virtual machine and attach the vhd you just created and boot it up..
well this was easy :)
Type your username and password and press Enter
Assign a static IP:
Edit-NanoServerImage -BasePath .\Base -TargetPath C:\NanoServer\NANO2016A.vhd -InterfaceNameOrIndex Ethernet -Ipv4Address 192.168.1.42 -Ipv4SubnetMask 255.255.255.0 -Ipv4Gateway 192.168.1.1
Now try pinging your First Nano Server
5.
We have couple of way to manage the Nano Server, i will show you how to access the Nano Server using pssession
Open the Power Shell as Administrator and run the following commands
net start winrm
Set-Item WSMan:\localhost\client\trustedhosts "192.168.1.42"
Enter-PSSession -ComputerName 192.168.1.42 -Credential nano2016a\Administrator
If you see the below error when trying to connect pssession for a nano Server then that mens that you have not added that IP of nano server to trusted hosts for Windows Remote Management.
run Set-item command for that IP and then try the pssession.
The example below i had a Nano Server named nano2016b IP: 192.168.1.43 not added to trusted.
So we have successfully logged in to Nano Server using PSSESSION
6.
To disable Windows firewall you can run the following commands in pssession
NetSh Advfirewall set allprofiles state off
net stop mpssvc
set-service -name "MpsSvc" -ComputerName -Status stopped -startuptype disabled
7.
Adding a DNS IP :
Get-DnsclientServeraddress - will list all the NIc's Server address
Set-dnsclientserveraddress -InterfaceIndex 3 -Serveraddress ("192.168.1.20")
or
Set-dnsclientserveraddress -InterfaceAlias "Ethernet" -ServerAddress '192.168.1.20'
8.
Adding Nano Server to Domain:
Follow the below steps if you don't have any Hyper V Server already in Domain:
a. login to any Windows 2012 R2 domain join Server
b. Run the below command
djoin /provision /domain vlab.com /machine nano2016a /savefile c:\nano2016b.txt
you will see a text file been created
If you see the AD now there will be Computer object with nano2016b pre-created.
c.
Map a drive to your Nano Server and copy the nano2016b,txt file
d.
Now enter the Nano Server using PS-Session and verify that txt file exists
run the following command:
djoin /requestODJ /loadfile c:\nano2016b.txt /windowspath c:\windows /localos
We have successfully add the Nano Server to domain, before you test make sure to reboot the Server.
Note:
If you don't update DNS details before joining to domain then DNS A record will not be created , then you will be to run the set-dns command and then do flush and register dns.
9.
Follow the below steps to add Nano Server to domain if you have any Hyper V Server already in Domain
New-NanoServerImage -MediaPath D:\ -BasePath .\Base2 -TargetPath C:\NanoServer\Test3 -ComputerName Test3 -GuestDrivers -Compute -Clustering -InterfaceNameOrIndex Ethernet -Ipv4Address 192.168.1.53 -Ipv4SubnetMask 255.255.255.0 -Ipv4Gateway 192.168.1.1 -DomainName vlab.com
So this will create a New VHD, assign IP and then add to domain as well...
Note: Please make sure to Set the DNS IP Address and do the registerdns to have a host record created in DNS.
10.
Disable IP6 if you need so:
Disable-NetAdapterBinding -InterfaceAlias "Ethernet" -ComponentID ms_tcpip6
11. if you seeing this error after adding to domain but unable to login with domain ID then probably you would have forgot to update the DNS, so add the DNS using set-dns, then flushdns and registerdns. Make sure you doing it by logging to nano server using psssession.
For more information you can take a look at this below MS article,
https://msdn.microsoft.com/en-us/library/mt126167.aspx
After playing for sometime it was easy to setup and move around.. but we should start brushing our Powershell knowledge if not done already as this is will be a must if you have to support Nano Servers.
Hopefully this helps someone!!! and until next one all have a good day!!!!