捕获 Windows 映像(。WIM) 文件并将其用于将 Windows 部署到新设备。
可以从 Windows 分发 ISO 中的 install.wim 文件开始,或者可以将正在运行的 Windows 映像通用化并捕获为 .WIM 文件。
WIM 文件仅捕获单个分区。 通常只能捕获 Windows 分区,然后使用该映像中的文件在驱动器上设置其余分区。 如果已创建自定义分区配置,请参阅 捕获和应用 Windows、系统和恢复分区。
捕获图像
如果已启动到 Windows,请将映像通用化,以便可以将其部署到其他设备。 有关详细信息,请参阅 Sysprep(通用化)Windows 安装。
使用 Windows PE 启动设备。
自选 优化映像,以减少应用映像后设备启动所需的时间。 优化映像在创建将部署到多台计算机的映像时特别有帮助,比如在现货生产方案中。
DISM /image:C:\ /optimize-image /boot
捕获 Windows 分区。 例如:
Dism /Capture-Image /ImageFile:"D:\Images\Fabrikam.wim" /CaptureDir:C:\ /Name:Fabrikam
其中 D:是 USB 闪存驱动器或其他文件存储位置。
应用图像
使用 Windows PE 启动设备。
擦除硬盘驱动器,并使用 脚本设置新的硬盘分区。 对旧版 BIOS 设备使用 CreatePartitions-UEFI.txt (或 CreatePartitions-BIOS.txt )。
diskpart /s CreatePartitions-UEFI.txt
使用 脚本处理映像。
D:\ApplyImage.bat D:\Images\Fabrikam.wim
示例脚本
下面是一个简单的示例脚本,该脚本将映像应用于一个已经使用步骤 2 中某个硬盘分区脚本分区过的磁盘。
Note
若要配置 Windows UEFI 2023 CA 的启动,可以在以下示例脚本中使用 /bootex 选项和 bcdboot 命令 。
rem == ApplyImage.bat ==
rem == These commands deploy a specified Windows
rem image file to the Windows partition, and configure
rem the system partition.
rem Usage: ApplyImage WimFileName
rem Example: ApplyImage E:\Images\ThinImage.wim ==
rem == Set high-performance power scheme to speed deployment ==
call powercfg /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
rem == Apply the image to the Windows partition ==
dism /Apply-Image /ImageFile:%1 /Index:1 /ApplyDir:W:\
rem == Copy boot files to the System partition ==
rem == Note: specify /bootex parameter to use Windows UEFI 2023 CA
W:\Windows\System32\bcdboot W:\Windows /s S:
:rem == Copy the Windows RE image to the
:rem Windows RE Tools partition ==
md R:\Recovery\WindowsRE
xcopy /h W:\Windows\System32\Recovery\Winre.wim R:\Recovery\WindowsRE\
:rem == Register the location of the recovery tools ==
W:\Windows\System32\Reagentc /Setreimage /Path R:\Recovery\WindowsRE /Target W:\Windows
:rem == Verify the configuration status of the images. ==
W:\Windows\System32\Reagentc /Info /Target W:\Windows
相关主题
使用完整闪存更新部署 Windows (FFU)
捕获和应用 Windows、系统和恢复分区
配置基于 UEFI/GPT 的硬盘分区
配置 BIOS/基于MBR的硬盘驱动器分区
BCDboot 命令行选项
REAgentC 命令行选项