Windows Imaging

Software, DIYs, and all creative related works.
User avatar
YiMeng
Author
Posts: 235
Joined: Sat Jul 18, 2020 10:58 pm
Location: NY
Contact:

Windows Imaging

Unread post by YiMeng »

Imaging is a technical term to backup a whole pc into a single file and be able to load when needed. Enterprise frequently does this to prepare and update batches of pc identically, that saves a whole bunch of time.

Imaging, however, is still a heavy lifting and time consuming task, and depending on what you have, pc models, os versions, media tools, iso images, and bios boot options can all effect the process and luck is sometimes definitely needed. 😂

Here's what I use, when all other methods fail.

1. ISO2USB: This aids in creating bootable usbs from iso image files.

2. DiskImager: This clones physical drives or images. Does not create bootable, but depending on source, this can clone a bootable image.

3. WinPEx64.iso: A bare-bone bootable winpe, to capture and deploy of images. This can be build with tools and resources from microsoft.


Capture/Save:
  • Verify current set boot option in bios for the source pc
  • Boot into source pc then execute "C:\windows\system32\sysprep\sysprep /generalize /oobe /unattend:unattend.xml"
    • unattended.xml is optional and is excluded in this guide. For more info here.
    • If sysprep fails, and this can happen for a number of reasons, you will have to view its log and troubleshoot there. However, if it is due to exceeding sysprep limit, I have had some luck with these solutions.
    • Upon success, choose to Shutdown.
  • Then, boot directly into WinPE to execute a compatible version of the capture command below.
  • Use “diskpart”, “lis vol” to verify your disk volumes. In the following command, “c:” specifies the source drive and "z:" specifies the destination drive (storage).

    Code: Select all

    Win7:
    imagex.exe /capture c: z:\image.wim "imageName" /verify
    
    Win10:
    dism /capture-image /imagefile:”z:\image.wim” /capturedir:”c:” /name:”imageName”
    
Apply/Restore:
  • Verify and set to use the same boot option in bios as source pc on the target pc.
  • Boot directly into WinPE on target pc.
  • BEWARE: BELOW WILL WIPE ALL DATA ON TARGET DISK.
  • Format disk, create partition and boot record. These are examples, customize to your needs, such as setting multiple partitions, specific partition sizes, and drive letters. Note that the size of the target drive must be same or bigger size than the imaged source drive.
    • Legacy boot:

      Code: Select all

      diskpart
      select disk 0
      clean
      create partition primary size=100
      select partition 1
      format fs=ntfs quick label system
      active
      assign letter s
      create partition primary
      select partition 2
      format fs=ntfs quick label Windows
      assign letter c
      exit
      
    • UEFI boot:

      Code: Select all

      diskpart
      select disk 0
      clean
      convert gpt
      create partition efi size 100
      format fs fat32 quick label system
      assign letter s
      create partition primary
      format fs ntfs quick label windows
      assign letter c
      exit
      
  • Execute a compatible version of the apply command below.

    Code: Select all

    Win7: 
    imagex /apply z:\image.wim 1 c: c:\windows\system32\bcdboot c:\windows
    
    Win10:
    dism /apply-image /imagefile:”z:\image.wim” /applydir:”c:” /index:1
    
    bcdboot c:\windows
    
  • Brings network shares into the mix:

    Code: Select all

    net use z: \\sharepath