创建一台拉倒服务器
把光盘上的 H:\NanoServer\NanoServerImageGenerator 复制到本地
加载模块 NanoServerImageGenerator
New-NanoServerImage -Edition Standard -DeploymentType Guest -MediaPath h:\ -BasePath .\BaseVHD -TargetPath .\Nano1\Nano.vhd -ComputerName Nano1
位于命令管道位置 1 的 cmdlet New-NanoServerImage
请为以下参数提供值:
AdministratorPassword: ********
Windows(R) Image to Virtual Hard Disk Converter for Windows(R) 10
Copyright (C) Microsoft Corporation. All rights reserved.
Version 10.0.14300.1000.amd64fre.rs1_release_svc.160324-1723
INFO : Looking for the requested Windows image in the WIM file
INFO : Image 1 selected (ServerStandardNano)...
INFO : Creating sparse disk...
INFO : Attaching VHD...
INFO : Initializing disk...
INFO : Creating single partition...
INFO : Formatting windows volume...
INFO : Windows path (F:) has been assigned.
INFO : System volume location: F:
INFO : Applying image to VHD. This could take a while...
INFO : Image was applied successfully.
INFO : Making image bootable...
INFO : Fixing the Device ID in the BCD store on VHD...
INFO : Drive is bootable. Cleaning up...
INFO : Closing VHD...
INFO : Closing Windows image...
INFO : Done.
Done. The log is at: C:\Users\XX\AppData\Local\Temp\NanoServerImageGenerator.log
创建的服务器很小,大概只有五百兆左右。
日志实际上就是一条命令:
New-NanoServerImage -Edition:Standard -DeploymentType:Guest -MediaPath:h:\ -BasePath:.\BaseVHD -TargetPath:.\Nano1\Nano.vhd -ComputerName:Nano1 -AdministratorPassword:System.Security.SecureString
& '.\BaseVHD\Tools\dism.exe' /Mount-Image /ImageFile:'C:\vhdx\Nano1\Nano.vhd' /MountDir:'C:\vhdx\BaseVHD\Temp\w1273885050' -Index:1 /LogLevel:2 /LogPath:'C:\Users\xx\AppData\Local\Temp\NanoServerImageGenerator (DISM).log'
& '.\BaseVHD\Tools\dism.exe' /Add-Package /PackagePath:'C:\vhdx\BaseVHD\Packages\Microsoft-NanoServer-Guest-Package.cab' /Image:'C:\vhdx\BaseVHD\Temp\w1273885050' /LogLevel:2 /LogPath:'C:\Users\xx\AppData\Local\Temp\NanoServerImageGenerator (DISM).log'
& '.\BaseVHD\Tools\dism.exe' /Add-Package /PackagePath:'C:\vhdx\BaseVHD\Packages\zh-cn\Microsoft-NanoServer-Guest-Package_zh-cn.cab' /Image:'C:\vhdx\BaseVHD\Temp\w1273885050' /LogLevel:2 /LogPath:'C:\Users\xx\AppData\Local\Temp\NanoServerImageGenerator (DISM).log'
& '.\BaseVHD\Tools\dism.exe' /Image:'C:\vhdx\BaseVHD\Temp\w1273885050' /Apply-Unattend:'.\BaseVHD\Temp\Unattend.xml' /LogLevel:2 /LogPath:'C:\Users\xx\AppData\Local\Temp\NanoServerImageGenerator (DISM).log'
& '.\BaseVHD\Tools\dism.exe' /Unmount-Image /MountDir:'C:\vhdx\BaseVHD\Temp\w1273885050' /Commit /LogLevel:2 /LogPath:'C:\Users\xx\AppData\Local\Temp\NanoServerImageGenerator (DISM).log'