Things hard and not so hard.... RSS 2.0

Folks - my blog has moved to

# Monday, 19 October 2009

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 - 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 : Core…or something more!

Check it out:

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: 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>]
Required parameters:
    The path of the WIM file to use when creating the VHD.  For example:
    Where X: is the drive letter of your DVD ROM drive.
    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:
    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:
    NOTE: If the language cannot be determined from the WIM, no <Lang> block
    will be included in the VHD name.
    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.
    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.
    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.
    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>
    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.
    Configures debugging in the OS on the VHD.
      /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
    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.
    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.
    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".
    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.

Monday, 19 October 2009 10:24:16 (AUS Eastern Standard Time, UTC+10:00)  #    Comments [0] -
Tips | WinPE
# Saturday, 09 May 2009

Well after a few hardware failures at work and many hours rebuilding servers that are *supposed* to have RAID 5 on them, I’m back online.
(They had RAID enabled at the BIOS level, and there’s a BIOS boot based tool that let’s you create/delete stripes etc. BUT you need to use the ‘Windows’ version of their tool to ‘REPAIR’ the volume. Now if you can’t boot to an O/S….here in lies my problem… I want to plug the new drive in and ‘boom’ rebuild done… but no!)

I wanted to share a tip which came out of all of this – Creating a Windows 7 Boot WinPE USB Key.
You know the 20 odd things you have lying around and are wondering what you could do with 1GB, 512MB etc keys.

You can make a boot disk out of them…cool… (provided your machine supports booting from USB, unlike my mac_mini at home running Windows 7 :)
You could make an x86 boot and on another create a x64 AND you can still store your data.

It’s not too tough really – couple of things you need upfront

  1. USB Key, drive or whatever
  2. Windows Application Installation Kit for Windows 7 RC (WAIK) – free download with the WinPE ‘image’ in it and all the tools (a WIM file)
  3. Some of your favourite recovery tools to add to your usb key

Ok good to go.

Let’s start

  1. Install the WAIK on your local machine – it installs folders for x86, amd64 and i64…cool
  2. From the Start Menu->All Programs->Microsoft Windows AIK->Deployment Tools Command Prompt
  3. Execute the command copype x86 c:\PEBuild (replace x86 for amd64 if you want 64bit. This will create the directory c:\PEBuild and copy the required files to get started.
  4. You’ll notice now that you should be in the C:\PEBuild folder – this is our ‘working space’ and there will be a couple of sub-directories here.
  5. Let’s mount the Image so we can manipulate files, and then later save them back into the Image for deployment, as follows:
    1. run the command imagex /mountrw winpe.wim 1 mount (this will mount the vanilla winpe.wim and create a ‘mount’ directory for us to use)

      - this didn’t work for me on 2 machines that I tried as follows (I was pretty happy)

      if this works for you – then great, it’s meant to. :-) (there maybe open files etc)

      Fortunately I had a PLAN B that works regardless (alot of the documentation use ImageX)

      Issue the command from the C:\PEBuild dir:
      dism /mount-wim /wimfile:winpe.wim /index:1 /mountdir:c:\PEBuild\Mount
    2. Go to the Mount Directory to see several folders – if you used my PlanB approach you can store the files in Program files if you like, or wherever. If you need access to the Startup folder it’s hidden in the same dir as Program Files.

      Copy your Win32/64 tools and utilities here to the mount dir (once fully booted up with WinPE, you will be in a RamDisk with the drive letter of X: – good idea to always use environment vars to get special folders if you need to)

      You can add other support like scripting, powershell etc – check out the packages
    3. Once done – commit the changes to the WinPE.wim with the command
      1. ImageX Cmd: imagex /unmount /commit /c:\pebuild\mount
      2. dism Cmd: dism /unmount-wim /moundir:c:\pebuild\mount /commit

    4. Almost done :)
    5. Copy the now *modified* WinPe.Wim image file to the correct directory (and we rename) so it runs smoothly in the boot sequence. Run copy /y winpe.wim iso/sources/boot.wim
    6. (optional step) To create an ISO of your work, issue the following command:
      ocsdimg –n –b”c:\Program Files\Windows AIK\Tools\x86\boot\” c:\PEBuild\ISO c:\PEBuild\WinPE.iso
    7. Next let’s add our good work to our USB key and we’re done (WE WILL ERASE YOUR KEY – back it up if needed. you can copy your stuff back on when we’ve finished)
      1. Plug your USB key in and we’re going to ntfs format it, create an active primary partition and assign a drive letter to it.
      2. From your command prompt use diskpart as follows:
        1. c:\PEBuild\diskpart
        2. list disk (you should see your USB drive come up in the list – this is the drive # to work with e.g. 1)
        3. sel disk 1 (double check from the previous command on what disk number your USB is on – mine is 1)
        4. clean
        5. create part primary
        6. sel part 1
        7. format fs=NTFS QUICK
        8. assign
        9. exit
        10. viola! your usb is now prepared.
    8. We need to do 2 final steps – copy everything within the ISO directory straight to your USB key. e.g. c:\PEBuild\ISO (from Explorer you’ll be able to get to your USB Key easily through the SendTo right mouse menu)

      Take note of your USB Key’s DRIVE letter
    9. Write the ‘bootsector’ as follows:
      1. c:\program files\Windows AIK\Tools\PETools\x86\bootsect /nt60 <drive letter of your USB Key>

Hopefully I’ve saved you some time and pain….. happy booting….

Saturday, 09 May 2009 00:54:36 (AUS Eastern Standard Time, UTC+10:00)  #    Comments [1] -
<2017 March>
 AppFabric CAT
AppFabric Windows Server Customer Advisory Team - New Blog.
[Feed] BizTalk 2006 - Windows SharePoint Services adapter
BizTalk 2006 Sharepoint adapter!!
 Breeze SharePoint 2010 Bootcamp
Breeze SharePoint 2010 Bootcamp
[Feed] BTS 2006 R2/EDI
[Feed] Chris Vidotto (MS BTS Legend)
Needs no intro....
 Mark Daunt
About the author/Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2017
Sign In
Total Posts: 608
This Year: 0
This Month: 0
This Week: 0
Comments: 270
All Content © 2017, Breeze