使用單一映射來捕捉及套用 Windows 映像。WIM 檔案Capture and apply a Windows image using a single .WIM file

( 中捕獲 Windows 映像。WIM) 的檔案,並使用它將 Windows 部署到新的裝置。Capture a Windows image (.WIM) file and use it to deploy Windows to new devices.

您可以從 Windows 發佈 ISO 的 install .wim 檔案開始,也可以將執行中的 Windows 映像一般化並捕獲到中。WIM 檔案。You can start with either the install.wim file from a Windows distribution ISO, or you can generalize and capture a running Windows image into a .WIM file.

WIM 檔案只會捕捉單一磁碟分割。WIM files only capture a single partition. 您通常可以只捕獲 Windows 磁碟分割,然後使用該映射中的檔案來設定磁片磁碟機上的其餘磁碟分割。You can usually capture just the Windows partition, and then use files from that image to set up the rest of the partitions on the drive. 如果您已建立自訂磁碟分割設定,請參閱「 捕獲並套用 Windows、系統和修復磁碟分割」。If you've created a custom partition configuration, see Capture and Apply Windows, System, and Recovery Partitions.

顯示具有空白硬碟的新電腦,加上一個 .wim 影像檔案的圖表,會展開成為多個設定的磁碟分割

擷取映像Capture the image

  1. 如果您已開機至 Windows,請將映射一般化,以便將它部署到其他裝置。If you've booted into Windows, generalize the image so that it can be deployed to other devices. 如需詳細資訊,請參閱 Sysprep (一般化) Windows 安裝For more information, see Sysprep (Generalize) a Windows installation.

  2. 使用 Windows PE啟動裝置。Boot the device using Windows PE.

  3. 選擇性 將映射優化,以減少裝置在套用映射後開機所花的時間。Optional Optimize the image to reduce the time it takes your device to boot after you apply the image. 當您在建立要部署到許多電腦的映射時(例如,在內建案例中),將映射優化特別有説明。Optimizing an image especially helps when you're building an image that you'll be deploying to many machines, like in a build-to-stock scenario.

    DISM /image:C:\ /optimize-image /boot
    
  4. 捕獲 Windows 磁碟分割。Capture the Windows partition. 例如:For example:

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

    其中 D:是 USB 快閃磁片磁碟機或其他檔案儲存位置。Where D: is a USB flash drive or other file storage location.

套用映射Apply the image

  1. 使用 Windows PE啟動裝置。Boot the device using Windows PE.

  2. 使用 腳本抹除硬碟並設定新的硬碟磁碟分割。Wipe the hard drive and set up new hard disk partitions using a script. 針對較舊的舊版 BIOS 裝置,使用 CreatePartitions-UEFI.txt (或 CreatePartitions-BIOS.txt) 。Use CreatePartitions-UEFI.txt (or CreatePartitions-BIOS.txt for older, legacy BIOS devices).

    diskpart /s CreatePartitions-UEFI.txt
    
  3. 使用 腳本套用影像。Apply the images using a script.

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

    範例指令碼:Sample script:

    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
    

使用完整 Flash 更新 (FFU) 部署 WindowsDeploy Windows using Full Flash Update (FFU)

擷取及套用 Windows、系統和復原磁碟分割Capture and Apply Windows, System, and Recovery Partitions

設定 UEFI/GPT 型硬碟磁碟分割Configure UEFI/GPT-Based Hard Drive Partitions

設定 BIOS/MBR 型硬碟磁碟分割Configure BIOS/MBR-Based Hard Drive Partitions

BCDboot Command-Line 選項BCDboot Command-Line Options

REAgentC 命令列選項REAgentC Command-Line Options