NanoServer は Server Core より更にコンパクトな Windows Server で、単体稼働するだけではなくコンテナテクノロジーにも使われています。
Windows Server 2016 Technical Preview 4(WS16TP4)になって NanoServer 環境も整ってきたので、WS16TP4 Hyper-V に NanoServer VM を作ってみましょう。
NanoServer は、OS インストーラーが準備されているのではなく、VHD
を生成するコマンドレットが提供されています。
困ったことに ja-JP な TP4 環境で VHD を作ると文字化けをするので、en-US な
WS16TP4 環境が必要になります。

ja-JP の WS16TP4 Hyper-V を構築しているからと言ってがっかりする必要はありません。VHD を作る環境に
en-US が必要なだけなので、作業用の en-US WS16TP VM を作れば済みます。
VHD を作るだけなので、Nested Hyper-V
にする必要もありません。
NanoServer の VHD 作成はざっくりこんな感じです。
・インストールメディアの \NanoServer をハードディスクにコピー
・VHD 作成モジュールを
Import
・VHD 作成
VHD を作る環境が準備出来たら、en-US の Windows Server インストールメディアをマウントし、インストールメディアから \NanoServer をハードディスクにコピーします。
PS C:\> robocopy D:\NanoServer c:\NanoServer /s /e
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : Wednesday, December 2, 2015 1:08:19 AM
Source = D:\NanoServer\
Dest : c:\NanoServer\
Files : *.*
Options : *.* /S /E /DCOPY:DA /COPY:DAT /R:1000000 /W:30
------------------------------------------------------------------------------
New Dir 4 D:\NanoServer\
100% New File 159928 Convert-WindowsImage.ps1
100% New File 130.6 m NanoServer.wim
100% New File 74020 NanoServerImageGenerator.psm1
100% New File 116 ReadMe.txt
New Dir 15 D:\NanoServer\Packages\
100% New File 13.9 m Microsoft-NanoServer-Compute-Package.cab
100% New File 8.7 m Microsoft-NanoServer-Containers-Package.cab
100% New File 117542 Microsoft-NanoServer-DCB-Package.cab
100% New File 124.4 m Microsoft-NanoServer-Defender-Package.cab
100% New File 1.6 m Microsoft-NanoServer-DNS-Package.cab
100% New File 512929 Microsoft-NanoServer-DSC-Package.cab
100% New File 8.1 m Microsoft-NanoServer-FailoverCluster-Package.cab
100% New File 620742 Microsoft-NanoServer-Guest-Package.cab
100% New File 1.8 m Microsoft-NanoServer-IIS-Package.cab
100% New File 168468 Microsoft-NanoServer-NPDS-Package.cab
100% New File 26.0 m Microsoft-NanoServer-OEM-Drivers-Package.cab
100% New File 9.4 m Microsoft-NanoServer-Storage-Package.cab
100% New File 615099 Microsoft-OneCore-ReverseForwarders-Package.cab
100% New File 52406 Microsoft-Windows-Server-SCVMM-Compute-Package.cab
100% New File 881258 Microsoft-Windows-Server-SCVMM-Package.cab
New Dir 15 D:\NanoServer\Packages\en-us\
100% New File 344182 Microsoft-NanoServer-Compute-Package.cab
100% New File 252904 Microsoft-NanoServer-Containers-Package.cab
100% New File 17754 Microsoft-NanoServer-DCB-Package.cab
100% New File 6252 Microsoft-NanoServer-Defender-Package.cab
100% New File 133614 Microsoft-NanoServer-DNS-Package.cab
100% New File 72789 Microsoft-NanoServer-DSC-Package.cab
100% New File 140780 Microsoft-NanoServer-FailoverCluster-Package.cab
100% New File 43744 Microsoft-NanoServer-Guest-Package.cab
100% New File 126005 Microsoft-NanoServer-IIS-Package.cab
100% New File 11293 Microsoft-NanoServer-NPDS-Package.cab
100% New File 389506 Microsoft-NanoServer-OEM-Drivers-Package.cab
100% New File 197535 Microsoft-NanoServer-Storage-Package.cab
100% New File 14705 Microsoft-OneCore-ReverseForwarders-Package.cab
100% New File 6479 Microsoft-Windows-Server-SCVMM-Compute-Package.cab
100% New File 9597 Microsoft-Windows-Server-SCVMM-Package.cab
------------------------------------------------------------------------------
Total Copied Skipped Mismatch FAILED Extras
Dirs : 3 3 0 0 0 0
Files : 34 34 0 0 0 0
Bytes : 329.64 m 329.64 m 0 0 0 0
Times : 0:00:01 0:00:01 0:00:00 0:00:00
Speed : 272599534 Bytes/sec.
Speed : 15598.270 MegaBytes/min.
Ended : Wednesday, December 2, 2015 1:08:20 AM
|
必要モジュールをコピーしたら、NanoServer VHD を作成するモジュールを Import します。
PS C:\> Import-Module "C:\NanoServer\NanoServerImageGenerator.psm1" -Verbose VERBOSE: Loading module from path 'C:\NanoServer\NanoServerImageGenerator.psm1'. VERBOSE: Importing function 'Edit-NanoServerImage'. VERBOSE: Importing function 'Get-NanoServerPackages'. VERBOSE: Importing function 'New-NanoServerImage'. |
モジュールのインポートが出来たら、NanoServer VHDを作成します。
作成時に設定するパスワードを聞かれますが、パスワードなしにします。
こうすると、VM
起動時にパスワード設定が出来ます。
PS C:\> md c:\work
Directory: C:\
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 11/28/2015 10:26 PM work
PS C:\> New-NanoServerImage -MediaPath D:\ -BasePath C:\work\wim -TargetPath C:\work\NanoServer01VM.vhdx -ComputerName NanoServer01 -GuestDrivers
cmdlet New-NanoServerImage at command pipeline position 1
Supply values for the following parameters:
AdministratorPassword:
Windows(R) Image to Virtual Hard Disk Converter for Windows(R) 10
Copyright (C) Microsoft Corporation. All rights reserved.
Version 10.0.10586.0.amd64fre.th2_release.151029-1700
INFO : Looking for the requested Windows image in the WIM file
INFO : Image 1 selected (ServerTuva)...
INFO : Creating sparse disk...
INFO : Attaching VHDX...
INFO : Initializing disk...
INFO : Creating EFI system partition...
INFO : Formatting system volume...
INFO : Setting system partition as ESP...
INFO : Creating MSR partition...
INFO : Creating windows partition...
INFO : Formatting windows volume...
INFO : Windows path (F:) has been assigned.
INFO : System volume location: E:
INFO : Applying image to VHDX. This could take a while...
INFO : Image was applied successfully.
INFO : Making image bootable...
INFO : Drive is bootable. Cleaning up...
INFO : Closing VHDX...
INFO : Closing Windows image...
INFO : Done.
Done. The log is at: C:\Users\ADMINI~1\AppData\Local\Temp\NanoServerImageGenerator.log
|
| -MediaPath | インストールメディアの Path |
| -BasePath | Wim の出力先 |
| -TargetPath | VHD の出力先 |
| -ComputerName | hostname |
出来上がった VHD

VHD は en-US で作る必要がありましたが、VM は ja-JP Hyper-V 環境で問題なく稼働するので、VHD をコピーし、Gen 2 VM を作成します。

VM 起動時にパスワード設定ができるので、F11 でパスワード設定します。

リカバリーコンソールで IP やファイアウォール設定が出来ますが、操作性は PowerShell の方が良いので、PowerShell Direct でIP設定がおすすめです。

PS C:\> Enter-PSSession -VMName NanoServer01 -Credential Administrator [NanoServer01]: PS C:\Users\Administrator\Documents> cd \ [NanoServer01]: PS C:\> Get-NetAdapter | New-NetIPAddress -AddressFamily IPv4 -IPAddress 192.168.33.15 -PrefixLength 24 -DefaultGateway 192.168.33.254 IPAddress : 192.168.33.15 InterfaceIndex : 3 InterfaceAlias : Ethernet AddressFamily : IPv4 Type : Unicast PrefixLength : 24 PrefixOrigin : Manual SuffixOrigin : Manual AddressState : Tentative ValidLifetime : Infinite ([TimeSpan]::MaxValue) PreferredLifetime : Infinite ([TimeSpan]::MaxValue) SkipAsSource : False PolicyStore : ActiveStore IPAddress : 192.168.33.15 InterfaceIndex : 3 InterfaceAlias : Ethernet AddressFamily : IPv4 Type : Unicast PrefixLength : 24 PrefixOrigin : Manual SuffixOrigin : Manual AddressState : Invalid ValidLifetime : Infinite ([TimeSpan]::MaxValue) PreferredLifetime : Infinite ([TimeSpan]::MaxValue) SkipAsSource : False PolicyStore : PersistentStore [NanoServer01]: PS C:\> Get-NetAdapter | Set-DnsClientServerAddress -ServerAddresses 192.168.33.1,192.168.33.2 |
en-US 環境なので、タイムゾーンは太平洋標準時間になっています。これを日本時間に変更します。
その後、設定を有効にするために一度 VM を再起動します。
[NanoServer01]: PS C:\> tzutil /g Pacific Standard Time [NanoServer01]: PS C:\> tzutil /s "Tokyo Standard Time" [NanoServer01]: PS C:\> Restart-Computer; exit |
ここまで設定できれば、GUI を持たない Windows なので、Enter-PSSession や Invoke-Command でリモート操作が可能になります。
初めてリモート操作するのであれば、接続元で winrm quickconfig -force と Set-Item WSMan:\localhost\Client\TrustedHosts * -Force でリモート操作を許可します。
PS C:\> winrm quickconfig -force WinRM サービスは、既にこのコンピューターで実行されています。 WinRM は、管理用にこのコンピューターへのリモート アクセスを許可するように設定されていません。 次の変更を行う必要があります: ローカル ユーザーにリモートで管理権限を付与するよう LocalAccountTokenFilterPolicy を構成してください。 WinRM はリモート管理用に更新されました。 ローカル ユーザーにリモートで管理権限を付与するよう LocalAccountTokenFilterPolicy を構成しました。 PS C:\> Set-Item WSMan:\localhost\Client\TrustedHosts * -Force |
NanoServer は、デフォルトで Enable-PSRemoting されているので、いきなり Enter-PSSession 出来ます。
Get-WindowsFeature が無いので、デフォルトで役割を Get-WindowsOptionalFeature を見ると、以下のようになっていました。
PS C:\> Enter-PSSession 192.168.33.15 -Credential administrator [192.168.33.15]: PS C:\Users\Administrator\Documents> cd \ [192.168.33.15]: PS C:\> Get-WindowsOptionalFeature -Online FeatureName : FileAndStorage-Services State : Enabled FeatureName : Storage-Services State : Enabled FeatureName : File-Services State : Disabled FeatureName : CoreFileServer State : Disabled FeatureName : File-Services-Search-Service State : Disabled FeatureName : SmbDirect State : Enabled FeatureName : MicrosoftWindowsOneCorePowerShellRoot State : Enabled FeatureName : MicrosoftWindowsOneCorePowerShell State : Enabled FeatureName : ServerManager-Core-RSAT State : Disabled FeatureName : ServerManager-Core-RSAT-Role-Tools State : Disabled FeatureName : ServerManager-Core-RSAT-Feature-Tools State : Disabled |
デフォルトだと思った以上にロールが無いですね。
メモリー要求は 199 MB ととても少ないです。

ディスクの使用量を確認しようとしたのですが、Get-PSDrive では使用量が確認でき無かったので、起動後の VHD サイズを見ると、708 MB と通常の Windows に比べてはるかにフットプリントは小さいです。

NanoServer は Server Core よりさらにコンパクトなので、全てのコマンドレットがサポートされているわけではありませんが、Get-Command で確認すると、思いのほか多くのコマンドレットがサポートされてるのにびっくりします。
また、ipconfig 等の基本コマンドもサポートされているので、CUI での操作性が著しく落ちるといった事は無さそうです。
![]()
Copyright © MURA All rights reserved.