Scott Hanselman

Step-By-Step: Turning a Windows 7 DVD or ISO into a Bootable VHD Virtual Machine

August 4, '09 Comments [31] Posted in Tools | Win7
Sponsored By

I'm loving the Windows 7 "Boot to VHD" lifestyle. This isn't Virtual Machines, to be clear, and it's not Dual Booting. It's Boot to VHD.

Let me break it down:

Method Pros Cons
Dual Booting Your OS's always run at full speed. You can screw up your partition table. You have to partition which means disks of fixed size. Or you can have them all share the same disk, which is dangerous.
OS's aren't portable.
Virtual Machines Your OS's are completely separate from each other and can't hurt one other. Your OS's are very portable. You get Undo support for your disks. Everything is virtualized, so you're taking a perf hit on pretty much everything. Often not a good solution for laptops.
Boot to VHD Your OS runs on the hardware directly, except your disk, which is virtualized and runs inside a single file. Estimated 3%-5% perf hit. Seriously. Also is awesome on a laptop if you have the HD space. None! But I'm biased! Neener neener!

Only works on internal drives or ESATA. No USB Drive support. No undo disk support.

Making a VHD is easy with Windows 7 since you can create and mount/attach VHDs in the standard tools. VHD as a disk format is built into the Operating System (although, strangely, you can't mount ISOs.).

You can create a blank VHD, set it up in your boot menu with BCDEdit (details and walkthrough here and a video demo here) and then just boot off your VHD. If you want to install your OS (Windows Server 2008 and Win 7 Enterprise or Ultimate are the only ones supported) then you just install away.

However, this is STILL not convenient enough for me.

I'm always trying crazy new Daily Builds of big stuff that takes a while to be installed. The step where I install an OS onto my VHD takes too long, so I'd like a prepared VHD that's already to be started for the first time, kind of like when you buy a machine from Dell or whoever and you get that nice "starting your computer, detecting drivers" action on first boot.

Well, there's a script over at the MSDN Code Gallery to help with this. It's the Windows Image to Virtual Hard Disk Converter (WIM2VHD).

From their description:

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!

I like this guy already.

How to SysPrep your Windows 7 Image

I copied my Windows 7 DVD to a folder on a drive with lots of space free. I probably didn't need to copy it over, but it likely made the process faster.

Then I downloaded and installed the Windows® Automated Installation Kit (AIK) for Windows® 7. This file is a large ISO (1.5G) so be aware. It's meant for admins, not humans. I didn't want to burn the ISO to disk, so I used 7-Zip to open the ISO as an archive and extract it. (If you're not using 7-Zip, you're missing out on life, BTW)

Now, go into C:\Program Files\Windows AIK\Tools and find ImageX.exe and copy it where you put the Windows Image to Virtual Hard Disk Converter (WIM2VHD) script.

Go read the Example Command Lines for Win2VHD, but since I had a Windows 7 Ultimate I ran this command-line. Note that d:\win7working is where I copied my DVD.

cscript wim2vhd.wsf /wim:d:\win7working\sources\install.wim /sku:ultimate

In this example, d:\win7working is the folder I copied the DVD to. Could be your DVD drive too, I suppose.

It chewed for a while, maybe seven minutes. You'll also here the "Device Plugged In" sound as the script automatically connects a VHD as a drive temporarily so don't panic:

D:\>cscript wim2vhd.wsf /wim:d:\win7working\sources\install.wim /sku:ultimate
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

Windows(R) Image to Virtual Hard Disk (WIM2VHD) Converter
Copyright (C) Microsoft Corporation. All rights reserved.
Version 6.1.7100.2

Check for updates at http://code.msdn.microsoft.com/wim2vhd!

MACHINE INFO:
Build=7600
Platform=amd64fre
OS=Windows 7 Ultimate
ServicePack=
Version=6.1
BuildLab=win7_rtm
BuildDate=090713-1255
Language=en-US

INFO: Looking for IMAGEX.EXE...
INFO: Looking for BCDBOOT.EXE...
INFO: Session key is E765F413-44E9-4F9B-AEA5-DBC8A726F7A6
INFO: Inspecting the WIM...
INFO: Configuring and formatting the VHD...
INFO: Applying the WIM...
[ 100% ] Applying progress
INFO: Making the VHD bootable with BCDBoot...
INFO: Unmounting the VHD...
Summary: Errors: 0, Warnings: 0, Successes: 1
INFO: Done.

Magical. Now I've got a 5 gig VHD file that I can setup to boot from directly as described here. The first time I start up, it'll be 95% into the setup process and just ready to detect my hardware. It's a nice "OEM-like" VHD that I can use again and again.

Since I'm only using these VHDs temporarily (for a week or two for testing) I won't use an activation key and instead leave that field blank during setup. That'll buy me 30 days of testing if I need to, and I can easily start over by just starting over with my new fresh VHD.

Enjoy! Now go tell Mike and his team that they're awesome. Go ahead. I'll wait here.

Related Links

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Step-By-Step: How To "Upgrade" from Windows XP to Windows 7

August 4, '09 Comments [32] Posted in Reviews | Tools | Win7
Sponsored By

image You've likely heard that you can't straight upgrade from Windows XP to Windows 7. You can upgrade from Windows Vista to Windows 7, but not from XP to 7. Some folks who apparently have a pile of operating systems discs have proposed that one could upgrade from XP to Vista, then from Vista to Windows 7, but I think that's insane. Most PC experts will recommend you start fresh and "pave" your machine anyway. I think this is a hassle, but in the case of XP to 7, it's necessary.

I was asked to "upgrade" a relative's machine from Windows XP to Windows 7, so I figured this was a good time to write-up the experience in case it helps others.

This is a screenshot heavy post, so bear with me, this is a tale best told with pictures.

Disclaimer: I do work for Microsoft, but I don't work with the Win7 team so this is just one dude's opinion. If this walkthrough paralyzes your hamster or causes you any emotional distress, we never spoke and I don't know you. You found it on the intertubes for free, so what do you expect. Good luck.

My relative has a nice basic Dell desktop with a gig of RAM and a 100 gig HD. The machine is 3-4 years old, so I didn't think a Windows 7 install would be unreasonable.

First, I put my Windows 7 disc into the Windows XP machine and got this screen:

f2

4 Personally, I wish that there was a "migrate your settings from Windows XP" button or something on this page. It's a great feature and it's not advertised enough.

I clicked "What to know before installing Windows."

The problem here, and with most OS installs regardless of vendor is that, at some point, reading and comprehension is required. Unless you're lucky enough to just click "next, next, next, finish," you need to read.

The instructions that show up at this point (shown at right) have a section on "Upgrading from Windows XP." In that section there's a link to http://go.microsoft.com/fwlink/?LinkID=142337 which is the one-stop-shopping center for Upgrade Info.

Specifically, the section on Upgrading from Windows XP to Windows 7 is what I needed.

The "Windows Easy Transfer" application is on the Windows 7 DVD in:

[CDDRIVE:]\support\migwiz\migsetup.exe

They probably named it migsetup.exe to make sure it wasn't named setup.exe and save some trouble with confused folks, but still, it was a smidge counter-intuitive.

Windows Easy Transfer

Here's the Windows XP machine running Windows Easy Transfer.

1

6

I've never see an "Easy Transfer cable" in the real world, but apparently they do exist on Amazon. Fortunately I had a small external hard drive, so I just used that since both the "old" and "new" computer were the same machine.

I was then asked this very tricky question, for which there is only one answer. ;)

7

Why yes, Windows Easy Transfer, this IS my old computer.

Next it found the 3 accounts on this XP machine as well as Shared Items and started tallying them up.

It spends some time (15 minutes or so in my case) estimating just how much non-Program data is on the machine.

9

In our case, it was about 15 gigs of Photos and general crap. It shows you what user has what stuff.

10

It also has a nice, but subtle, customize link under each name you should click on. You can be very specific as to the folders and settings you care about.

Hit next and wait a while. I waited about an hour, but it was telling me what was up the whole time.

11

It made a giant archive ".MIG" file on my portable hard drive.

image

Installing Windows 7

Next, I actually installed Windows 7. I decided to let Windows 7 format the hard drive so I could start from scratch. I could have just installed 7 over the top, but the hard drive was a bit untidy, so I just took the opportunity to start fresh.

I installed Windows 7 the regular way and created a single Administrator user to start with.

Next, I ran Easy Transfer from the Windows 7 Start Menu. At this point, remember that nothing has been transferred and I have a fresh Windows 7 machine.

Select that this is your new computer and pick the migration file from the external hard drive.

Capture

When you see the list of names in the migration file, click Customize. This allows you to map the old names to potentially new names/users on the new machine, or exclude names completely.

You'll have to wait a while again, I waited about an hour. After the process is done, you get the option for very detailed report. It shows not only what was transferred in detail but also a list of applications "you might want to install."

12

This was very helpful as it reminded me of the different apps I needed to get on this machine to make it ready for my relative.

13

It's true that this isn't an "upgrade" as it's a "migration" but an hour or so later I was all set and my relative had a machine with all the things they were used to exactly where they expected them to be. Documents, Photos, Accounts, all brought over cleanly. It even remembered that their daughter wasn't an admin and brought over the Parental Controls settings.

If you've got an XP machine and you're looking to go Windows 7, I recommend you at least give this built-in tool a look. It saved me a few hours of setup at least and brought over settings that I'd have had to recreate. Even usernames and passwords for iTunes and Zune and MSN Messenger came along.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Hanselminutes Podcast 173 - All About Microsoft with Mary Jo Foley

August 3, '09 Comments [6] Posted in Microsoft | Podcast
Sponsored By

image My one-hundred-and-seventy-third podcast is up. Mary Jo Foley writes the All About Microsoft blog for ZDNet and has worked as a journalist covering Microsoft for years. Scott and Mary Jo chat about Windows 7 and the future of Microsoft.

Links from the Show

Subscribe:
Subscribe to Hanselminutes Subscribe to my Podcast in iTunes

Do also remember the complete archives are always up and they have PDF Transcripts, a little known feature that show up a few weeks after each show.

Telerik is a sponsor for this show!

Building quality software is never easy. It requires skills and imagination. We cannot promise to improve your skills, but when it comes to User Interface, we can provide the building blocks to take your application a step closer to your imagination. Explore the leading UI suites for ASP.NET and Windows Forms. Enjoy the versatility of our new-generation Reporting Tool. Dive into our online community. Visit www.telerik.com.

As I've said before this show comes to you with the audio expertise and stewardship of Carl Franklin. The name comes from Travis Illig, but the goal of the show is simple. Avoid wasting the listener's time. (and make the commute less boring)

Enjoy. Who knows what'll happen in the next show?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Hanselminutes on 9 - ASP.NET MVC 2 Preview 1 Released

July 31, '09 Comments [5] Posted in ASP.NET | ASP.NET MVC | Channel9 | Podcast
Sponsored By

Virtual Scott HanselmanI was up in Redmond this week and stopped by to visit my Video Portal in Phil's Office. I wanted to see where I virtually sit.

While I was there, Phil gave me/us/you a tour of ASP.NET MVC 2 Preview 1.

Be sure to read ScottGu's post on ASP.NET MVC 2. The best point:

  • Today’s preview works with .NET 3.5 SP1 and VS 2008, and can be installed side-by-side on the same machine as ASP.NET MVC 1.0 (meaning they don’t conflict and your existing ASP.NET MVC 1.0 projects will not be impacted if you install it).

Quoting from the ASP.NET MVC Roadmap, the theme for ASP.NET MVC 2 is "Improved Productivity and Enterprise Ready."

ASP.NET MVC 2 Features

Preview 1 - Early August

  • Templated Helpers - allow you to automatically associate edit and display elements with data types. For example, a date picker UI element can be automatically rendered every time data of type System.DateTime is used. This is similar to Field Templates in ASP.NET Dynamic Data.
  • Areas - provide a means of dividing a large web application into multiple projects, each of which can be developed in relative isolation. This helps developers manage the complexity of building a large application by providing a way to group related controllers and views.
  • Support for Data Annotations - Data Annotations enable attaching validation logic in a central location via metadata attributes applied directly to a model class. First introduced in ASP.NET Dynamic Data, these attributes are now integrated into the default model binder and provide a metadata driven means to validating user input.

Preview 2 and beyond

  • Client Validation - builds on top of the Templated Helpers and Data Annotations work done in Preview 1 to provide client-side validation based on the model's validation attributes. This provides for a more responsive experience for users filling out a form with validation.
  • Strongly-typed input helpers – allow generating form input fields using code expressions against the model. This allows the helpers to take advantage of Data Annotations attributes applied to the model and reduces errors caused by lack of strong typing such as typos.
  • Strongly-typed link helpers – allow developers to take advantage of Intellisense support (due to the strong typing) to discover which controllers and actions are available for linking.
  • Asynchronous Controller Actions - provides a programming model for writing actions that can call external resources without blocking a thread. This can increase the scalability of a site that needs to interact with web services and other external services.
  • Areas - continued refining of the Areas feature, enabling a single project approach for developers who wish to organize their application without requiring multiple projects.
  • Other Improvements - continue to fix known issues carried over from ASP.NET MVC 1.0 as well as ASP.NET MVC 2 Preview 1. Also including API improvements based on user feedback along with minor new features.

There's lots of cool stuff (release notes are here) and in this video Phil shows off Templated Helpers. There's a walkthrough of Templated Helpers in the Pre-Release Documentation as well.

Remember, it's a preview, so there's still time to give feedback. Blog about it, complain in the forums, or bug us on Twitter.

I hope you enjoy the video!

Related Links

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Hanselminutes Podcast 172 - Dan Bricklin on Technology

July 26, '09 Comments [4] Posted in Podcast | Programming
Sponsored By

image My one-hundred-and-seventy-second podcast is up. Dan Bricklin is an innovator and entrepreneur, and created VisiCalc, the first electronic spreadsheet in 1979. He's just written a book called Bricklin on Technology full of observations, stories, case histories and insight into the human aspect of technology. This week he sits down with me. (So cool! Woot!)

Links from the Show

Subscribe:
Subscribe to Hanselminutes Subscribe to my Podcast in iTunes

Do also remember the complete archives are always up and they have PDF Transcripts, a little known feature that show up a few weeks after each show.

Telerik is a sponsor for this show!

Building quality software is never easy. It requires skills and imagination. We cannot promise to improve your skills, but when it comes to User Interface, we can provide the building blocks to take your application a step closer to your imagination. Explore the leading UI suites for ASP.NET and Windows Forms. Enjoy the versatility of our new-generation Reporting Tool. Dive into our online community. Visit www.telerik.com.

As I've said before this show comes to you with the audio expertise and stewardship of Carl Franklin. The name comes from Travis Illig, but the goal of the show is simple. Avoid wasting the listener's time. (and make the commute less boring)

Enjoy. Who knows what'll happen in the next show?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

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