Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just setup and sysprepped a nice new VM, now I need to convert it to a wim real quick, to upload to my sccm server. For some reason, I can't change the VM properties to boot from a legacy nic for pxe, which is how I usually capture my images using sccm. VMM just changes the settings right back, even though it says successful.

Anyway, the first page of google was terrible for this, w/ the exception of a 3rd party .ps1 script on MS's website, but I'm using 2012r2, I should be able to do this natively, right?

share|improve this question
up vote 17 down vote accepted

Absolutely, let's post a prim and proper answer for Google. This is a simple 2 command Powershell execution, using the dism module. The dism can be copied to earlier versions of Windows, provided you have the appropriate version of the windows management framework.

First, mount the vhd using

Mount-WindowsImage -ImagePath C:\VHDs\BigHomies.vhdx -Path C:\VHDMount -Index 1

Then, capture it into a wim with

New-WindowsImage -CapturePath C:\VHDMount -Name Win7Image -ImagePath C:\CapturedWIMs\Win7.wim -Description "Yet another Windows 7 Image" -Verify

And let it do it's thing. When you are done you can unmount the vhd and discard any changes using:

Dismount-WindowsImage -Path C:\VHDMount -Discard
share|improve this answer
1  
Correction to the second command: -ImagePath should specify the full path to the WIM file (e.g. C:\CapturedWIMs\NewWinImage.wim), while -Name is the name of the image inside the WIM file (e.g. NewWinImage, but has no actual relation to the WIM file name). Executing the originally posted command results in "New-WindowsImage: Access is denied." (presumably because the command attempts to treat the C:\CapturedWIMs directory as a file). – Jakub Berezanski Oct 1 '14 at 22:34
    
Interesting analysis, technet's example also seems to agree with you. I'll update it, even though I ripped this straight from my powershell prompt lol. – BigHomie Oct 3 '14 at 12:20
1  
+1 this answer really helped me out! – Joshua McKinnon Jul 20 '15 at 17:45

If, for some reason, Powershell is not an option - do not despair!

In Windows 7 or later, you can mount the .vhd via disk management (link)

Once it is mounted, you can use imagex.exe to capture the .wim (technet link)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.