From a management workstation, mount the Windows 2016 ISO (i.e. doubleclick it, take note of the driveletter). On the ISO file you will see a NanoServer directory:
That directory has the NanoServer.wim file, Packages folder and a NanoServerImageGenerator folder. That last folder contains a PowerShell Module, which you need to import in an Administrator PowerShell window (which in my case is on the E: drive):
 Import-Module E:\NanoServer\NanoServerImageGenerator\NanoServerImageGenerator.psm1 
Now you should have a bunch of extra commands available:
 PS C:\Users\Akos> get-command -Module *nano* | select Name
Name                 
----                 
Edit-NanoServerImage 
Get-NanoServerPackage
New-NanoServerImage  
The New-NanoServerImage cmdlet is the one you will need to create a fully functional image. The options are a slew of information. I've created a splatted variable set below, otherwise the line becomes far too long for the blog ;-)
 $Pwd = ConvertTo-SecureString -String "Pa$$w0rd!" -AsPlainText -Force
$Options = @{
    MediaPath = 'E:' #Location of DVD
    BasePath = 'D:\TMP\Base' #Location of install files
    TargetPath = 'D:\TMP\NanoWeb01.vhdx' #Where the vhdx will come
    ComputerName = 'NanoWeb01' #No idea, I think the computername..
    AdministratorPassword = "$Pwd" #A secure string password
    DeploymentType = 'Guest' #This will make it a vhdx file
    Edition = 'Standard' #Windows version (Standard or Datacenter)
    Package = 'Microsoft-NanoServer-IIS-Package' #Packages, in this case IIS
}
New-NanoServerImage -EnableRemoteManagementPort -Storage @Options
There are several packages you can choose from, which can be found by the Get-NanoServerPackage cmdlet:
 PS C:\Users\Akos> Get-NanoServerPackage -MediaPath e:
Microsoft-NanoServer-Compute-Package
Microsoft-NanoServer-Containers-Package
Microsoft-NanoServer-DCB-Package
Microsoft-NanoServer-Defender-Package
Microsoft-NanoServer-DNS-Package
Microsoft-NanoServer-DSC-Package
Microsoft-NanoServer-FailoverCluster-Package
Microsoft-NanoServer-Guest-Package
Microsoft-NanoServer-Host-Package
Microsoft-NanoServer-IIS-Package
Microsoft-NanoServer-OEM-Drivers-Package
Microsoft-NanoServer-SCVMM-Compute-Package
Microsoft-NanoServer-SCVMM-Package
Microsoft-NanoServer-SecureStartup-Package
Microsoft-NanoServer-ShieldedVM-Package
Microsoft-NanoServer-SoftwareInventoryLogging-Package
Microsoft-NanoServer-Storage-Package 
Next to this there are other switches too, of which a complete list and more info can be found on Microsoft's site. In all, Nano server takes a little work to get it running, but once it does, it starts in seconds.
Edit: You may have noticed the -Storage and -EnableRemoteManagementPort switches in my New-NanoServerImage command. I just saw in a different article, you can put them in the splatted options as well, by doing "Storage = $true" and the same for EnableRemoteManagementPort. You learn something new every day..

No comments:
Post a Comment