Monday, 12 December 2016

Managing the Nano Server

The Nano Server is built as a headless deployment. This means that it cannot be managed via the usual way of connecting a monitor, keyboard and mouse to the server. If we connect to the server using monitor, keyboard and mouse, here's what we get...
A simple login...
...and the "Recovery Console",
which allows us to do only a few things.
The Nano Server is meant to be managed remotely, i.e. from another machine.

Managing the Nano Server using PowerShell


The following is done on a Windows 10 computer. To connect to the Nano Server, we first need to start the "Windows Remote Management" service on the computer that we are connecting from, which in this case, the Windows 10 computer.
Starting the "Windows Remote Management" service
in our Windows 10...
Then we launch our PowerShell as Administrator...
Launching PowerShell as Administrator..
Then we issue these 2 commands...

1
2
Set-Item WSMan:\localhost\Client\TrustedHosts "192.168.123.200"  
Enter-PSSession -ComputerName "192.168.123.200" -Credential "192.168.123.200\administrator" 
... where 192.168.123.200 is the IP address of the Nano Server in this article. The first commands tells the Windows 10 computer that it is safe to talk to the Nano Server. The second command connects to the Nano Server.
Here's what it looks like...
(You will be prompted for the administrator password of the Nano Server at the second command.)
After this, all commands issued are for the Nano Server. Take for example...
(This Nano Server is installed with Hyper-V, and is running 1 virtual machine.)

Managing the Nano Server using Server Manager and MMC


To manage the Nano Server using Server Manager, we need to use the Server Manager in another computer. (The Nano Server does not have GUI components. But it can talk to other servers installed with GUI components.) In this article, we will be using a Windows 2012 Server, installed with GUI components.

Similar to the Windows 10 computer, we need to do these 2 things before we start connecting to the Nano Server.

  1. Start the "Windows Remote Management" service.
  2. From PowerShell, issue command 
    Set-Item WSMan:\localhost\Client\TrustedHosts "192.168.123.200"

Then we launch Server Manager and...
Right click "All Servers", click "Add Servers".
Key in the IP address of the Nano Server.

Click "Yes".


If you encounter authentication issues, right click the Nano Server, click "Manage As".

Key in the credentials. Note the syntax of the username.
Not all the MMC work in the Nano Server because the Nano Server is a minimalistic server, having enough components just to do its job. In the example below, it shows that parts of "Computer Management" works, such as the Event Viewer...



... and Hyper-V Manager works too...



For any MMC that does not work, we have to manage the Nano Server via PowerShell. For example, patching the server.

Here are the commands...

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Scan for updates
 
$ci = New-CimInstance -Namespace root/Microsoft/Windows/WindowsUpdate -ClassName MSFT_WUOperationsSession
$result = $ci | Invoke-CimMethod -MethodName ScanForUpdates -Arguments @{SearchCriteria="IsInstalled=0";OnlineScan=$true}
$result.Updates
 
# Install all updates
 
Invoke-CimMethod -InputObject $ci -MethodName ApplyApplicableUpdates
 
Restart-Computer
 
# List Installed Updates
 
$ci = New-CimInstance -Namespace root/Microsoft/Windows/WindowsUpdate -ClassName MSFT_WUOperationsSession
$result = $ci | Invoke-CimMethod -MethodName ScanForUpdates -Arguments @{SearchCriteria="IsInstalled=1";OnlineScan=$true}
$result.Updates

Here's what it looks like...
After this, the Nano Server will reboot...
After the server has rebooted, we can check whether the detected updates are installed.
The Nano Server can be managed using MMC running on another computer, but using PowerShell allows us to do more things.