问小白 wenxiaobai
资讯
历史
科技
环境与自然
成长
游戏
财经
文学与艺术
美食
健康
家居
文化
情感
汽车
三农
军事
旅行
运动
教育
生活
星座命理

使用单个 .WIM 文件捕获和应用 Windows 映像

创作时间:
作者:
@小白创作中心

使用单个 .WIM 文件捕获和应用 Windows 映像

引用
1
来源
1.
https://learn.microsoft.com/zh-cn/windows-hardware/manufacture/desktop/deploy-windows-with-a-script-sxs?view=windows-11

本文介绍了如何使用单个 .WIM 文件捕获和应用 Windows 映像。通过本文,您可以学习如何将 Windows 分发 ISO 中的 install.wim 文件或正在运行的 Windows 映像通用化并捕获到 .WIM 文件中,以及如何将该映像部署到新设备。

捕获 Windows 映像 (.WIM) 文件,并使用该文件将 Windows 部署到新设备。

可以从 Windows 分发 ISO 中的 install.wim 文件开始,或者可以将正在运行的 Windows 映像通用化并捕获到 .WIM 文件中。

WIM 文件只捕获单个分区。 通常可以只捕获 Windows 分区,然后使用该映像中的文件来设置驱动器上的其余分区。 如果已创建自定义分区配置,请参阅捕获和应用 Windows、系统和恢复分区。

捕获映像

  1. 如果已启动到 Windows,请将映像通用化,使其可以部署到其他设备。 有关详细信息,请参阅Sysprep(通用化)Windows 安装。

  2. 使用Windows PE启动设备。

  3. 可选:优化映像,以减少在应用映像后设备启动所需的时间。 在构建要部署到多台计算机的映像时(例如在存货生产方案中),优化映像特别有用。

    DISM /image:C:\ /optimize-image /boot
    
  4. 捕获 Windows 分区。 例如:

    Dism /Capture-Image /ImageFile:"D:\Images\Fabrikam.wim" /CaptureDir:C:\ /Name:Fabrikam
    

    其中 D: 是 U 盘或其他文件存储位置。

应用映像

  1. 使用Windows PE启动设备。

  2. 使用脚本擦除硬盘驱动器并设置新的硬盘分区。 使用CreatePartitions-UEFI.txt(对于旧版 BIOS 设备,请使用CreatePartitions-BIOS.txt)。

    diskpart /s CreatePartitions-UEFI.txt
    
  3. 使用脚本应用映像。

    D:\ApplyImage.bat D:\Images\Fabrikam.wim
    

示例脚本

下面是一个简单的示例脚本,该脚本将映像应用到一个使用步骤 2 中的其中一个硬盘分区脚本进行分区的磁盘。

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 ==
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

相关主题

  • 使用完整闪存更新 (FFU) 部署 Windows
  • 捕获和应用 Windows 分区、系统分区与恢复分区
  • 配置基于 UEFI/GPT 的硬盘分区
  • 配置基于 BIOS/MBR 的硬盘分区
  • BCDboot 命令行选项
  • REAgentC 命令行选项

本文原文来自微软官方文档

© 2023 北京元石科技有限公司 ◎ 京公网安备 11010802042949号