Whilst on my travels last week I also ran into Oleg Lofman (MCS SharePoint Consultant)
whom amongst other things (showed me a great travel game – http://www.travelpod.com/traveler-iq?ba96=7587)
pointed me towards a tool called WIM2VHD.

Basically this tool allows you to go straight from a WIM file to VHD!! You
can even specify an Answer file also. So no need to mount the ISO, go through the
bootloader and copy all the files needed, then expand etc etc as part of the setup.

So seeing that Windows 7/Server 2008 R2 has a bunch of WIMs under the \Sources folder,
you can simply go there and take your pick as to how extensive you want the base OS
to be : Coreor something more!

Check it out:

http://code.msdn.microsoft.com/wim2vhd

As you can see below, it’s a pretty extensive and detailed tool: (you can even apply
hotfixes to the VHD during this process)

— snip from the above page —

Usage

Usage: WIM2VHD.WSF /wim:<wimPath> /sku:<sku>
[/vhd:<vhdPath>] [/size:<vhdSizeInMb>] [/disktype:<dynamic|fixed>]
[/unattend:<unattendXmlPath>] [/qfe:<qfe1,...,qfeN>]
[/ref:<ref1,...,refN] [/dbg:<args>] [/copylocal:<localFolder>]
[/passthru:<physicalDrive>] [/signdisk:<true|false>]
[/mergefolder:<folderToMerge>]
 
Required parameters:
 
  /wim:<wimPath>
 
    The path of the WIM file to use when creating the VHD.  For example:
    X:\sources\install.wim
 
    Where X: is the drive letter of your DVD ROM drive.
 
  /sku:<skuName>|<skuIndex>
 
    The SKU within the WIM to use when creating the VHD (e.g. "ServerStandard",
    "ServerDatacenterCore", "2", etc.).  This value can either be passed as a
    SKU name (typically the easiest method) or as a SKU index (which requires
    you to have manually inspected the WIM with a tool like IMAGEX.EXE).
 
Optional parameters:
 
  /vhd:<vhdPath>
 
    The path and name of the VHD to be created.  If a file with this name
    already exists, it will be overwritten.  If no VHD is specified, a VHD will
    be created in the current folder with a name in the following format:
    <Major>.<Minor>.<Build>.<Rev>.<Arch>.<Branch>.<Timestamp>.<SKU>.<Lang>.vhd
    ex:
       6.1.7100.0.x86fre.winmain_win7rc.090421-1700.Ultimate.en-us.vhd
 
    NOTE: If the language cannot be determined from the WIM, no <Lang> block
    will be included in the VHD name.
 
  /size:<vhdSizeInMb>
 
    For Fixed disks, this is the size in MB of the VHD that will be created.
    For Dynamic disks, this is the maximum size in MB that the VHD can grow to
    as additional space is required.
    If unspecified, a default value of 40960 MB (40 GB) will be used.
 
  /disktype:<Dynamic|Fixed>
 
    Specifies what kind of VHD should be created: Dynamic or Fixed.
    A Fixed disk allocates all of the necessary disk space for the VHD upon
    creation.  A Dynamic disk only allocates the space required by files in
    the VHD at any given time, and will grow as more space is required.
    The default value is Dynamic.
 
  /unattend:<unattendXmlPath>
 
    The path to an unattend.xml file that will be used to automate the OOBE
    portion of Windows setup the first time the VHD is booted.
 
  /qfe:<qfe1,...,qfeN>
 
    A comma-separated list of QFEs to apply to the VHD after the WIM is
    applied.  QFEs must be in the .MSU file format, which is the default
    QFE format for Windows 7.  They can also be provided in a .CAB format
    if you'd prefer to extract the .CABs from the .MSU files.
 
    To extract a CAB from an .MSU, use the following command:
 
    expand -f:win*.cab <.MSU file> <location to extract to>
 
  /ref:<ref1,...,refN>
 
    A comma-separated list of WIM pieces to apply to the VHD.
    A "WIM piece" is the result of a Split WIM, and typically has a .SWM
    file extension.  The first piece of the Split WIM should be specified with
    the /WIM switch. Subsequent pieces should be specified with /REF.
      ex: WIM2VHD.WSF /WIM:C:\split.swm /REF:C:\split2.swm,c:\split3.swm
 
    See IMAGEX.EXE /SPLIT /? for more information.
 
  /dbg:<protocol>,<port/channel/target>[,<baudrate>]
 
    Configures debugging in the OS on the VHD.
    examples:
      /dbg:serial,1,115200 - configures serial debugging on COM1 at 115200bps
      /dbg:1394,10 - configures 1394 debugging on channel 10
      /dbg:usb,debugging - configures USB debugging with the target DEBUGGING
 
  /copylocal:<localFolder>
 
    Copies all of the files necessary to run WIM2VHD.WSF to localFolder,
    eliminating the need to install the Windows AIK or OPK.  This does not
    include any WIM files, just the binaries that WIM2VHD.WSF depends on.
    After this operating completes, run WIM2VHD.WSF from localFolder.
    If this switch is specified, no VHD will be created.
 
  /passthru:<physicalDrive>
 
    Applies the WIM directly to the specified drive and makes it bootable.
    NOTE: The partition on the disk must be marked as ACTIVE in order to boot
    successfully. This action is NOT performed by WIM2VHD.WSF.
 
  /signdisk:<true|false>
 
    Specifies whether or not WIM2VHD.WSF should leave a signature on the VHD
    that indicates what version of WIM2VHD.WSF created the VHD, and the date
    of creation.  The signature will be located at <VHD>:\Windows\WIM2VHD.TXT.
    The default value is "true".
 
  /mergefolder:<folderToMerge>
 
    Copies the contents of folderToMerge to the root directory of the VHD.
    This includes all subfiles and subfolders.  Any files that already exist on
    the VHD will be overwritten.


 

 

This will certainly make my life easier when it comes to building VMs!!! Thanks Oleg
for the tip.