Windows – Create “raw disk file” from WIM file

imageimagexraw-diskwindows

First timer here. I've searched around here, but haven't found a question like the one I have. Apologies if I missed it.

The challenge at hand: produce a "raw disk image file" from a given WIM file. What I am pursuing so far is to use imagex.exe with the "/apply" operation to take the WIM and lay it down in a directory on a server. That seems to produce all the necessary "stuff" I need in that directory.

How would I take that content and produce a "raw disk image file"? I'm told the definition of "raw disk image file" is a block-by-block copy of the disk image, which I hope is the output of the "imagex.exe /apply" command I use currently, but stored in a single file I can hand back to another system in our solution.

imagex.exe /apply image.wim 1 R:\WimImagePoint

I would like to take the contents of R:\WimImagePoint and produce the elusive (to me) "raw disk image file". ISO is not what they want, nor is anything requiring winPE.

Any pointers? External utilities' references are welcome. Would like to avoid unmanaged code solutions as much as possible, but will entertain them if that's the only route.

Also, I am not married to the idea of imagex /apply as the starting point, it's just the comfort zone so far.

Best Answer

Here's what I wound up doing (submitting answer to my own question to help the greater good, I hope):

Use diskpart.exe with the following commands in a text file:

create vdisk file=E:\Temp\RawDisk\2003R2_amd64\2003_R2_amd64.vhd maximum=10000 type=expandable
select vdisk file=E:\Temp\RawDisk\2003R2_amd64\2003_R2_amd64.vhd
attach vdisk
create partition primary
assign letter=v
format fs=ntfs quick label=vhd
active
exit

Then, I used the /apply option off of imagex.exe to apply the WIM file to this logical volume:

imagex.exe /apply 2003_R2_amd64.WIM 1 V:\

Then, used either bootsect.exe (server 2003) or bcdboot.exe (server 2008 and 2008 R2). This example is for 2003:

"C:\Program Files\Windows AIK\Tools\PETools\amd64\bootsect.exe" /NT52 V:

Then, ran diskpart.exe again with these commands in a text file:

select vdisk file=E:\Temp\RawDisk\2003R2_amd64\2003_R2_amd64.vhd
detach vdisk

Then, we ran some homegrown VHD to VMDK code and all is well. I suspect you can take this VHD and convert it using standard tools as well.

Hope this helps the greater good.