Create a wim image of windows installation

Boot a Windows PE image by dvd, usb or network.

You will end up with a cmd prompt :
X:\windows\system32\>wpeinit

IF you want to work with a network location instead of a USB drive or local hdd you can map it with:
net use n: \\networkpc\sharename passwords /user:usernameView partitions :
diskpart
list volume
exit

For windows 7 :
f:\imagex.exe /capture d: f:\mywin_c.wim “Win_Vol”
and optional : 
f:\imagex.exe /capture e: f:\mywin_d.wim “Data_Vol” 


To restore them on another pc, boot pe image :
First to make the partition we will use a file : 

X:\windows\system32\>diskpart /s diskpart.txt


diskpart.txt :

Select disk 0
Clean
Create partition primary size=81920
Select partition 1
assign letter=c
active
Format fs=ntfs quick
Create partition primary
Select partition 2
assign letter=d
Format fs=ntfs quick
Exit


X:\windows\system32\>F:

F:>imagex.exe /apply f:\xt3215pos7.wim1 d:
F:>imagex.exe /apply f:\xt3215pos7_d.wim1 e:

bcdboot c:\windows

For windows 8 or 8.1 you have to use DISM

Dism /Capture-Image /ImageFile:F:\mywin_SR.wim  /CaptureDir:C:\ /Name:”System Reserved”

Dism /Capture-Image /ImageFile:F:\mywin_c.wim  /CaptureDir:D:\ /Name:”Win_Vol”
Dism /Capture-Image /ImageFile:F:\mywin_c.wim  /CaptureDir:E:\ /Name:”Data_Vol”

to apply image :

Dism /apply-image /imagefile=n:\SPACERI34160\mywin_c.wim /index:1  /ApplyDir:D:\
Dism /apply-image /imagefile=n:\SPACERI34160\mywin_d.wim /index:1 /ApplyDir:E:\

bcdboot C:\Windows /l en-US
————-
Errors :

dism /Capture-Image
The capture-image option is unknown – you need to run winpe 5.1

Imagex Error 112 There Is Not Enough Space On The Disk error – you probably are saving the image to a usb stick that is formatted with fat32 that has a file limit of 4gb – format the usb to NTFS

While capturing a windows 8 or windows 8.1 with imagex you get a lot of warnings and it takes a long time (around 45 min) to make the image.
[ INFO ] Ignoring Extended Attributes in [c:\Program Files\xxxxxxx]
To capture a windows 8 or 8.1 installation you have to use dism with win pe 5.1 as imagex does not know to read and/or restore the Extended Attributes form windows 8

————————–

To automate more :
Edit /sources/boot.wim/windows/system32/startnet.cmd :

wpeinit

d:
diskpart /s diskpart.txt
Imagex.exe /apply KS6815posrdyEB31.wim 1 c:

Exit

Leave a Comment