Posts Tagged ‘wim2vhd’

RTM-Weekend! Win7, 2008 R2, Boot from VHD and more!

August 2nd, 2009

Yay! It’s RTM Weekend! Alright, not for everyone, because as we all are patiently waiting for August 6th as RTM hits TechNet and MSDN, but I needed to get the jump on things because I think I’m busy next weekend!

So, what does RTM weekend entail for me?  Testing was the first ground.   Testing installations on my hardware, and getting a feel for how I’ll architect my deployment model for Win7 and 2008R2!

First things first – Create bootable VHD Images to run my OS out of.    Yes, I planned to deploy my systems via Boot from VHD, so I needed to create bootable images! And for this little decision, I opted to take advantage of WIM2VHD! So, what exactly is WIM2VHD?  Well, that’s pretty simple to explain!

The Windows(R) Image to Virtual Hard Disk (WIM2VHD) command-line tool allows you to create sysprepped VHD images from any Windows 7 installation source. VHDs created by WIM2VHD will boot directly to the Out Of Box Experience, ready for your first-use customizations. You can also automate the OOBE by supplying your own unattend.xml file, making the possibilities limitless.
Fresh squeezed, organically grown, free-range VHDs – just like Mom used to make – that work with Virtual PC, Virtual Server, Microsoft Hyper-V, and Windows 7’s new Native VHD-Boot functionality!

All you need in order to be successful with WIM2VHD is:

  • A computer running one of the following Windows operating systems:
    • Windows 7 Beta or RC (or RTM)
    • Windows Server 2008 R2 Beta or RC (or RTM)
    • Windows Server 2008 with Hyper-V RTM enabled (x64 only)
  • The Windows 7 RC Automated Installation Kit (AIK) or Windows OEM Pre-Installation Kit (OPK) installed.
  • A Windows 7 or Windows Server 2008 R2 installation source, or another Windows image captured to a .WIM file.

Then, simply execute a command like I did below and you’re moving along!

Create a bootable VHD of Windows 7 Ultimate
cscript WIM2VHD.WSF /wim:D:\sources\install.wim /sku:ultimate /VHD:C:\vhd\win7ult.vhd

Create a bootable VHD of Windows Server 2008 R2 Enterprise
cscript WIM2VHD.WSF /wim:D:\sources\install.wim /sku:serverenterprise /VHD:C:\vhd\R2Ent.vhd

This frankly takes care of most of the work on your  behalf! (Sure did for me!)

FYI: The image defaults to 40gb, so if you want to change that, use this flag /size:<vhdSizeInMb>

After this point all you need to do is bcdedit and make the system bootable and you’re set!

bcdedit /copy {current} /d “New VHD Description”
    bcdedit /copy {current} /d “Windows 7 Ultimate”
bcdedit /set <guid> device vhd=[driveletter:]\<directory>\<vhd filename>
    bcdedit /set {GUID} device vhd=[c:]\vhd\win7ult.vhd
bcdedit /set <guid> osdevice vhd=[driverletter:]\<directory>\<vhd filename>
    bcdedit /set {GUID} osdevice vhd=[c:]\vhd\win7ult.vhd
bcdedit /set <guid> detecthal on
    bcdedit /set {GUID} detecthal on

And you can perform those same exact steps again for your 2008 R2 VHD as well.   It’s not only pretty straight forward, but it’s so simple anyone can do it! After performing those steps I was up and running on a system which had no data, nothing, notta!

Now, to apply some context and depth to how I chose to use my deployment model.  I’m running on my personal Lenovo T61p, which I have a Kingston 128GB SSD disk inside of.   Because I wanted to have ‘some’ kind of Native OS in order to help work on anything should something go wrong, I opted for a 2008 Server R2 Enterprise (Core) installation.  That gives me a minimal foot print, yet an OS I can feel comfortable and confident in being able to work on and with!  

What this enables is my NOS which runs on the “C:” drive, and has a VHD directory where my images live.  However, when I’m booted into either of my BootFromVHD OS’s on here, the native SSD becomes the “D:” drive whereby I can share files between the two systems!   However, if you forget to copy something to the shared volume and need to access it, feel free to use the mount VHD feature in the Disk Management tool (or Storage in 2008)

image image

I personally prefer to mount it read-only because… I don’t want to take any risks, especially when it comes to “Anti-Virus” or other things. (Unless that is my specific intention)

Now that you have a working and operational system you’re good to go! And if you stick with a NativeOS for Maintenance reasons, you can use it to take hard backups of your VHD’s for migration to other hardware or general recovery to other points in time! (note: You can backup the un-used OS from your active OS if you’d like as well :))

So, hope you have a good RTM weekend coming up, I look forward to being able to generate and use my license keys come August 6th!

Tags: , , , , , , , , , , ,
Posted in Azure, Baltimization, Blog, Hyper-V, Microsoft, SSD, Virtualization, Windows 7, Windows Server | Comments (3)

  • Archives