How to add the SMTP Server role in Nano Server

windows-nano-serverwindows-server-2016

Using the info on this TechNet page, I've successfully established a remote PowerShell session with a 2016 Preview 2 Nano Server running in a Hyper-V VM.

I now want to add the SMTP Server role. I was expecting this to be a trivial matter, as we are given to understand Nano Server is the future of Windows Server and will do everything we're used to from Windows Server, except that it's "headless", i.e., can only be managed remotely, which is done via WMI and PowerShell.

However, it seems roles and features aren't added in the traditional way, using PowerShell cmdlets such as Add-WindowsFeature, but rather by using dism to add Packages to the VHD image. Okay, but there are only about five Packages, which don't include SMTP Server. Only things to do with Hyper-V, Failover Clustering, Networking, and File Server role.

I did try Add-WindowsFeature and suchlike in the remote PowerShell session, but it didn't recognize any of the usual cmdlet names. I suspect this is more than just the cmdlets not being present.

Perhaps this is just a limitation of the pre-release Nano Server? But I couldn't find any statement to that effect.

Is it possible to add the SMTP Server role in Nano Server?

EDIT: here is the output from Get-WindowsFeature:

PS C:\Users\Administrator\Documents> Get-WindowsFeature
Command 'Get-WindowsFeature' cannot be found.

…and from Get-Module:

PS C:\Users\Administrator\Documents> get-module -listavailable


    Directory: C:\windows\system32\windowspowershell\v1.0\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   1.0.0.0    CimCmdlets                          {Get-CimAssociatedInstance, Get-CimClass, Get-CimInstance, ...
Manifest   1.0        Defender                            {Get-MpPreference, Set-MpPreference, Add-MpPreference, Remo...
Script     3.0        Dism                                {Add-AppxProvisionedPackage, Add-WindowsDriver, Add-Windows...
Manifest   0.0        DnsClient
Manifest   1.0.0.0    EventTracingManagement              {New-EtwTraceSession, Get-EtwTraceSession, Set-EtwTraceSess...
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-ItemProperty, Join-Path...}
Manifest   3.0.0.0    Microsoft.PowerShell.Security       {Get-Acl, Set-Acl, Get-PfxCertificate, Get-Credential...}
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Format-List, Format-Custom, Format-Table, Format-Wide...}
Manifest   3.0.0.0    Microsoft.WSMan.Management          {Disable-WSManCredSSP, Enable-WSManCredSSP, Get-WSManCredSS...
Manifest   2.0.0.0    NetAdapter                          {Disable-NetAdapter, Disable-NetAdapterBinding, Disable-Net...
Manifest   1.0.0.0    NetEventPacketCapture               {New-NetEventSession, Remove-NetEventSession, Get-NetEventS...
Manifest   1.0.0.0    NetTCPIP                            {Get-NetIPAddress, Get-NetIPInterface, Get-NetIPv4Protocol,...
Manifest   1.0.0.0    PcsvDevice                          {Get-PcsvDevice, Start-PcsvDevice, Stop-PcsvDevice, Restart...
Manifest   1.0.0.0    PnpDevice                           {Get-PnpDevice, Get-PnpDeviceProperty, Enable-PnpDevice, Di...
Manifest   2.0.0.0    SmbShare                            {Get-SmbShare, Remove-SmbShare, Set-SmbShare, Block-SmbShar...
Manifest   2.0.0.0    SmbWitness                          {Get-SmbWitnessClient, Move-SmbWitnessClient, gsmbw, msmbw...}
Manifest   2.0.0.0    Storage                             {Add-InitiatorIdToMaskingSet, Add-PartitionAccessPath, Add-...

(end)

Best Answer

It is early days for Nano Servers. What we have right now is an early preview and only a very limited number of features is supported. IIS and SMTP are not among them.

Get-WindowsFeature is from the Server Manager module which is not enabled on Nano

dism.exe -online -get-features -format:table

you get something like:

------------------------------------- | --------
Feature Name                          | State
------------------------------------- | --------
ServerManager-Core-RSAT               | Disabled
ServerManager-Core-RSAT-Role-Tools    | Disabled
ServerManager-Core-RSAT-Feature-Tools | Disabled
FileAndStorage-Services               | Enabled
Storage-Services                      | Enabled
File-Services                         | Enabled
CoreFileServer                        | Enabled
File-Services-Search-Service          | Disabled
Dedup-Core                            | Disabled
SmbDirect                             | Enabled
Microsoft-Hyper-V                     | Enabled
FailoverCluster-NanoServer            | Enabled
SmbWitness                            | Disabled
Storage-Replica                       | Disabled

You can use Enable-WindowsOptionalFeature to enable some, but that doesn't really help.

As long as we don't have any additional packages we can not add more features to the server.

Related Topic