VhdCapture & VhdPrep: Using these tools to P2V your physical server to USB, Network Share


In today’s post, I want to spend some time sharing how to use the virtualization tools that our team (MPSD Development) built as part of the Configuration Manager Physical-to-Virtual Migration Toolkit (ConfigMgr P2V).  In previous posts, I shared how ConfigMgr customers could utilize the toolkit for migration purposes as well as sharing how others can take advantage of some of the features for those who are not ConfigMgr customers (shame on you!)

The underlying libraries our team built include three key components:

  • VHD Capture:  This binary is used to create an exact replica of any MBR-based physical disk into Virtual Hard Disk (VHD) format.  It is driven fully as a command-line utility and is scriptable if you choose to utilize in this manner.
  • VHD Capture Wizard:  This provides a nice, graphical experience to select the proper disk to virtualize and storage location to save the VHD
  • VHD Prep:  This stand-alone utility is multi-faceted and I will cover below but its purpose is to optimize the VHD (e.g. compact) while also ensure that the VHD is fully Hyper-V ready.

In the coming sections, I will outline in detail how you can use these tools where ever you choose.

NOTE:  I've attached the tools for those of you who do not currently have access to the Configuration Manager console installed or handily available.

Getting The Tools:  Obtaining the Binaries

In order to use the tools, you obviously need to download the ConfigMgr P2V Toolkit.  After you install, all binaries that are part of the installation by default go in %programfiles%\Configuration Manager P2V Migration Toolkit.  For the purpose of this post, we will deal with binaries available in the BIN directory.


Using VHD Capture (vhdcapture.exe) to Virtualize a Physical Disk

The use of VHD capture requires you to understand the syntax and the easy way to determine the syntax is to use the simple /? syntax to understand the available options.  For simplicity, I’m going to share a screen shot of this output for you to review -


The key usages is to list all the physical disks (potential sources) that are available to capture using the list switch.  Beyond this, the typical syntax used to make action occur is the following:

 1: vhdcapture capture -savePath:{path to location}

For the purpose of this example, I would like to capture my physical volume named “Data” that has all my data I’d like to keep around during a migration.  Let’s take a look at that…

  1. Open path \VHDTools in a Command Prompt
  2. Type VHDCapture.exe capture -savePath:\\server\scratch\chrad\MyDataDrive –disk:1

This will result in a VHD created in the path \\server\scratch\chrad\MyDataDrive with the name Disk0.vhd.  This will take my data drive and create a virtualized copy of this single partition on Disk 0.


Using VHD Capture Wizard:  If your graphical, your golden

Because we realized that for some people, using command-line isn’t their preferred method if they are capturing only a single partition or disk.  It is because of this that we created a separate experience that provides a graphical experience for selecting the disk/partition to virtualize and also where you’d like to store the resulting VHD file.  This user experience still uses the same libraries used by the command-line so you shouldn’t worry if they are different – they are the exact same.

To use VHD Capture Wizard, do the following:

  1. Open path \bin\vhdtools
  2. Start VhdCaptureWizard.exe
  3. On the Welcome screen, click Nextimage
  4. On the Select Drives screen, check the Drives you’d like to virtualizeimage
  5. For Select Location, click Browse and input a location to save your VHD (2nd Drive, USB, Network Share)image
  6. After clicking Next, we will start creating a VHD at that locationimage

After this is completed, you will click Finish to close the wizard.  The end result for the demo listed above is that I will now see a VHD created on the share named Disk0.vhd.

Verifying VHD:  Did this thing really work?

To verify the success of the creation of your VHD it is rather simple assuming you have Windows 7 or 2008 available.  To effectively load the volume, and verify data integrity, do the following:

  1. Click Storage (Server 2008 Only)
  2. Open Disk Management
  3. Right-click, select Attach VHDimage
  4. Select the path to the newly created VHD
  5. In Windows Explorer, navigate the drive and verify the data is correctimage

Preparation:  The Key to a Happy Ending

The VHD Capture, and the wizard, both create pristine copies of the physical disk layout with partitions.  This includes unused sectors on the disk.  Obviously, this isn’t an optimized experience when attempting to re-use the disk.  This could be a satisfactory situation for some if doing data protection & backup.  To optimize the VHD, while also allowing it work work correctly in Hyper-V, we created the VHDPrep.exe tool that allows us to ensure that the VHD is ready to go.

The functions provided automatically by VHDPrep include the following:

  1. Use’s Hyper-V’s compact function to remove unused sectors
  2. Injects critical boot drivers to allow the VHD to properly boot the Windows OS (if necessary)
  3. Corrects NT Boot Sector issues for Windows Server 2003
  4. Aligns physical disk layout to virtual disk layout
  5. Modifies boot entries to leverage virtual storage drivers

The VHD prep tool is a separate tool designed to run after you’ve successfully captured the VHD.  For many, you might ask why we didn’t just do this automatically.  We separated this functionality because we felt that not everyone requires that the disks are bootable, etc. and so we wanted to create the pristine nature of the VHD created by the command-line & wizard.  We would love to hear your feedback if you believe this is the wrong design but for now we felt it offers you the maximum flexibility.

To utilize VHD Prep, please do the following:

  1. Open the path \bin\VHDPrep
  2. Type vhdprep.exe {path to VHD}

This will start the edit process of your prisitine VHD and make the modifications to make it successfully work with Hyper-V.  If you would like to retain the original, you should duplicate (copy) the VHD and then target the copy.  This is a nice fail safe to ensure that you still have the virtual copy of the physical disk.


This is it.  You’ve now gotten an introduction to the tools that can make P2V happen without using Task Sequences, ConfigMgr, or anything other than just your keyboard and a few libraries.


We feel good about the P2V Toolkit and it’s ability to aid IT professionals and administrators store offline copies of physical disks in a virtual format (VHD) that is supported by the popular Hyper-V.  In today’s post, I outlined using a non-VMM solution that support P2V’ing of any MBR-based disk in use today in the market place.  This toolkit is currently in CTP1 format and we will soon release the next non-RTW version with an impending final release date later this year.

For now, I hope you’ve enjoyed some of the details behind using the ConfigMgr P2V Migration Toolkit!





Comments (18)
  1. ChrAd says:

    Hey Koenbs-

    Yep, good point.  I might need to update the blog to share those details.  I will also look at "attaching" them to the blog so that you can test them 🙂



  2. ChrAd says:

    Hey Benbo (and others :)-

    I just uploaded a new VHD Tools zip file that has all the files from the MSI for P2V Migration Toolkit.  This should allow you to execute using the WinPE Creator to create a bootable USB/DVD that will immediately load to the VHD P2V Wizard.

    Let me know if this doesn't work for you as this will stump me if this is the case 🙂

    NOTE:  The only supported by Microsoft method is to use this for P2V of a Configuration Manager 2007 server.  However, I've used the libraries for many other platforms with no problem.  Just a normal "caveat" as you wouldn't want to call Microsoft support.


  3. ChrAd says:

    Hey Benbo-

    What version of Service Pack do you have on your Windows Server 2003 box?  It was tested on any version that is supported as a platform for Configuration Manager 2007 which is outlined here – technet.microsoft.com/…/cc161860.aspx.

    Share that info with me and I'm also checking to make sure that these are the P2V released bits as I don't know if I uploaded the latest when all was said and done 🙂


  4. ChrAd says:


    The tools have been uploaded and attached.  This should include the 3 components outlined in this blog post.



  5. ChrAd says:

    Oh no, I do not like hearing that you are more confused now :o.  That is certainly the wrong direction.  Basically, you are correct that in order to get the bits to install you have to install the ConfigMgr 2007 Admin Console as this is the reason the tools were built (to help migration in non-VMM scenarios for ConfigMgr) and as such we locked it down.

    However, the tools for doing P2V are actually agnostic completely to ConfigMgr.  The P2V files in the ZIP are the libraries needed to do P2V and you do *not* need the Action Pad.  However, you do need to build a bootable using the steps I outlined above if you are grabbing the OS drive.  If you don't it will not work.  Thus, you can P2V within the full OS a non-system drive using VhdCreatorWizard.exe but if you want to do it for system you should follow instructions here – blogs.technet.com/…/using-winpe-creator-to-create-virtual-hard-drive-vhd-of-your-physical-server.aspx

    I'm going to update the bits today for the ZIP as the ones on this blog are still our RC1 bits and not the RTW located on the download site.

    If you are still stuck, email me at c.h.r.a.d at Microsoft dot com.  Please remove the "dots" 🙂



  6. Abduljalil says:

    Nice tool

  7. ChrAd says:

    Thanks Leonardo!  I hope you enjoy!

  8. ChrAd says:


    I updated this blog to point to the RTW binaries that were released on the Microsoft Download Center.  If you are using the old RC bits, please re-download to get the released goodness.



  9. Anonymous says:

    Okay thanks Chris. My understanding now is I do *not* require the ConfigMgr 2007 Admin Console, but to P2V a server system drive must do the following:

    • Create a bootable WinPE on a USB device using the "Windows PC creator wizard " (but see question below)

    • Expand the VhdTools.zip onto the WinPE system on the USB device.

    Assuming the WinPE is created successfully on the USB device:

    • Insert the USB device on the Server

    • Boot the WinPe system from the USB device (mercy me)

    • When the WinPe comes up, run the VHDCaptureWizard.exe to create a VHD of the Server system drive on the inserted USB device (I assume the mention of VhdCreatorWizard.exe was a typo).

    The question is:  how do you launch the "Windows PC creator wizard" if you do not have the Action Pad – the link says you launch it from the Action Pad. Presumably it means you must download and run the Windows Automated Installation Kit for Windows 7 instead.

    Thanks very much for your help.

  10. Anonymous says:

    The P2V migration kit expects SCCM Console to be installed on my system.

    Unable to test the vhdtools 🙂

  11. ChrAd says:

    Hey George-

    You Rock!  Those handy tips almost deserve their own blog.  I very well might do that if you think it would make these blogs more helpful.  I'm glad that you got everything working for you!


  12. Anonymous says:

    Running x86VhdToolsVHDCapture.exe from VhdTools.zip on Windows Server 2003 gets error: VirtDisk.dll not found. Also x86VhdToolsAppLaunch.cmd tries to run c:windowssystem32wpeinit.exe which also appears to be missing.

    Is VhdTools.zip complete or does it depend on other components: in which case can you advise where they can be found?

  13. Anonymous says:

    No problem; it's all about sharing what I found down the roads less travelled, like non-domain joined PC's; who does that 😉

    Another weird thing; the 32-bit WinPE on an old, old, (really old) system would not create an image using the GUI wizard because it could not determine if the disk would fit on the destination.

    However, when browsing for the dest.folder free space is correctly listed for all drives, including the USB dest.disk. Using a network share with plenty of free space net the same error.

    Since I usually use the x64 WinPE, I don't know if this is something specific to the x86 image or something weird with the specific system.

    I used the VHDCAPTURE commandline in the booted x86 image to do the conversion instead.


  14. Anonymous says:

    Chris – Thanks for the quick response: actually it’s Windows Server 2003 SP2. The server is standalone and installed with Italian version of Windows 2003 Server and uses 2 x disk Raid configuration with only about 16GB used. (I tried running the VhdTools.zip
    tools on the server just to see the screens, and which produced the problems reported earlier).

    I have to admit having re-read the blog articles I’m unfortunately more confused as to what the required procedural steps are to create a VHD.  The "previous posts" link given above references a lot of articles and it’s not clear which particular ones to

    Further, the sentence “The first step is to obtain either a USB flash drive or to use CD/DVD media as this is required to create the bootable media.  Beyond this, the process is fairly simple overall.  Let’s step through it… To create a non-task sequence
    based bootable media, select from the action pad the following option”…etc.

    But, from the ACTION PAD article at:
     this appears to be depend on: Windows 7 Automated Installation Kit (WAIK) and Configuration Manager 2007 Administration Console – “to
    be installed on the client workstation”: Which implies a separate PC must be available to install all of this software on in order to create the USB bootable media – but then I’m not confident I’ve understood this correctly.

    Notice also the following link, referred to above, returns “Page not found”:

    Configuration Manager Physical-to-Virtual Migration Toolkit (ConfigMgr P2V):

    Thanks for your help.

  15. jnagy53 says:

    Using VhdCaptureWizard.exe and I don't get any drivers in the drivers list


  16. ChrAd says:

    Hey Jnagy53-

    Do you mind emailing a screen shot if possible of what you are seeing?  It has been 2+ years since I've worked on the P2V toolkit so I'm a bit rusty (sorry!)



Comments are closed.

Skip to main content