Create and deploy a sysprep image from a vhdx

Hi guys,

With the below commands we can deploy a winpe image made with WADK 8.1 for WS 2012 R2

Regards

Create a WinPEMEdia

  • Install ADK 8.1
  • Start deployment and imaging tools environment as Administrator
  • copype amd64 c:\winpe_amd64
  • Copy VHD at this directory before made winpemedia
  • MakeWinPEMedia /ISO C:\WinPE_amd64 C:\WinPE_x86\WinPE_x86.iso

Create image:

  • Diskpart

o    create vdisk file=C:\temp\vhd\master.vhdx maximum=122880 type=expandable

o    select vdisk file=C:\temp\vhd\master.vhdx

o    Attach vdisk

o    create partition primary

o    assign letter=V

o    format quick label=vhd

o    Exit

  • Dism /apply-image /imagefile:E:\sources\install.wim /index:4 /applydir:V:\
  • Diskpart

o    Select vdisk file=C:\temp\vhd_cloud\master.vhdx

o    Detach vdisk

o    Exit

Install image

  • Boot host with WinPE (with vhdx) generated before.
  • Diskpart

o    Select disk 0

o    Clean

o    Create partition primary size=350

o    Format quick fs=ntfs

o    Assign letter=s

o    Active

o    Create partition primary

o    Format quick fs=ntfs

o    Assign letter=c       (maybe you need to leave C: from Winpe and reassign to another drive letter)

o    exit

  • Copy vhdx to C:

o    Diskpart

o    List volume

o    Detect volume where is vhdx and copy to c:

  • Diskpart

o    Select vdisk file=c:\master_win.vhdx

o    Attach vdisk

o    List volume

o    Select volume (press volume number for attached disk)

o    Assign letter=v

o    Exit

  • Cd v:\Windows\system32
  • Bcdboot v:\windows
  • Diskpart

o    Select vdisk file=c:\master_win.vhdx

o    Detach vdisk

o    exit

o    exit (reboot)

  • password: XXXXXX
  • Change to your System Locale – Reboot
  • Format your language and country
  • Copy Settings to default user and Welcome screen
  • Powercfg /hibernate OFF (for HyperV hosts)
  • powercfg /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c (for HyperV hosts)
  • Eventvwr, everyone to 51200 and Overwrite as needed