DESKTOP

Automating Windows 7 Installation : Getting Familiar with Microsoft Images (part 1) - Creating a Bootable VHD Image

10/27/2013 7:36:03 PM

Installation of Windows changed quite a bit with Windows Vista, and Microsoft improved this imaging technology with Windows 7. Previously, you installed the operating system by copying individual files, often from the i386 folder of the installation disc. However, now the installation disc includes images in the form of a single file that you'll use for the installation of Windows 7.

Additionally, you can modify any installation of Windows 7 and create your own image. You can then use tools to deploy the images that you create.

1. Image Types: VHD and WIM

There are two overall types of images within Windows 7: virtual hard drive (VHD) images have a filename extension of .vhd, and Windows Imaging Format (WIM) images have an extension of .wim. You can boot to both VHD and WIM images.

A VHD image is a Windows 7 operating system with applications. You can create a VHD image when you begin an installation of Windows 7, install Windows 7 on the VHD, and then boot into VHD. Once the VHD is started, it works just like a normal installation. Only the Windows 7 Enterprise and Ultimate editions support booting from VHDs. Although most features are available in a VHD image of Windows 7, there are some limitations. For example, a VHD image doesn't support BitLocker or dynamic disks.

The WIM images have two types: Windows preinstallation images (also called boot images) and operating system images (which include the full installation of Windows 7).


Preinstallation Images

A preinstallation image boots into WinPE. This is a minimal Windows environment with limited services running. The installation DVD includes the boot.wim file that boots into WinPE.You can also create a Windows Recovery Environment (WinRE) bootable disc that extends the WinPE.


Operating System Images

You can have either thin or thick operating system images. A thin image has only the operating system installed. The install.wim file on the installation DVD includes thin images of various editions of Windows 7. A thick image is a fully configured installation and has applications installed.

2. Creating a Bootable VHD Image

A VHD image is simply a VHD file that includes a fully functioning operating system. This is the same VHD image type used by Microsoft Virtual PC and Microsoft's Hyper-V virtual program (which is available on Server 2008 and Server 2008 R2). Windows 7 can also boot directly into a VHD file or use a VHD file as a dual-boot system. Because the VHD image is a single file, you can easily back up the entire operating system environment by copying the file. This approach has several benefits; you can:


Test application compatibility.

You can install applications on the VHD image and test them for compatibility. If the application corrupts the operating system, you can simply shut it down, delete the corrupted VHD image, and copy your original VHD image back.


Create an isolated development environment.

Application developers often need an isolated environment to develop, test, and debug applications. Bugs can sometimes affect the stability of the operating system. However, if an errant application corrupts the operating system, it can easily be restored by copying the original VHD image.


Test malware or other vulnerabilities.

Security professionals often need an isolated environment to test the effect of malware. It's not a good idea to do this in a live environment, but a system running on a virtual image can be isolated for testing.

VHD Limitations

While bootable VHDs have a lot of benefits, there are some limitations. First and foremost, you can create a bootable VHD with only Windows 7 Enterprise and Ultimate editions. Other Windows 7 editions don't support it. Other limitations include the following:

  • BitLocker is not supported on Windows 7 VHD images.

  • VHD images do not support hibernation.

  • Bootable VHD images can't be compressed.

  • The VHD can't be bigger than 2 TB.

  • The VHD file must be located on an NTFS drive.


Follow these steps to create a bootable VHD image on an existing installation of Windows.

  1. Place the installation DVD into the system and restart it. The system will automatically load WinPE and you'll be presented with the first Windows 7 installation screen.

  2. Press Shift+F10 to access the command prompt.

  3. At the command prompt, enter DiskPart and press Enter. The DiskPart program will start and the prompt will change to DISKPART>.

  4. Enter the following command to create a virtual disk file named MasterWin7.vhd:

    Create vdisk file = c:\MasterWin7.vhd maximum=40960 type=expandable

    The command creates a file about 2 MB in size, but it is dynamically expandable to 40 GB (40,960 MB). You can adjust the size based on your needs and available hard drive space. After the file is created you'll see a message indicating that DiskPart successfully created the virtual disk file. You can name the file something different but you must include the .vhd extension.

  5. You can't manipulate the file until you select it, so select the virtual disk (vdisk) file with the following command:

    Select vdisk file=c:\MasterWin7.vhd

    If desired, you can view the selected disk by issuing the List Vdisk command. However, since the disk is not attached, it can't determine the type of the disk and it will be listed as Unknown.

  6. Attach the vdisk file with the following command:

    Attach vdisk

    You can now view details on the vdisk with the List Vdisk command and it will show the file as Expandable.

  7. Enter List Disk and press Enter. You'll see all your disks on the system. The 40 GB disk is listed with an asterisk (*) indicating it's selected; it has a status of Online, and it has 40 GB free.

  8. Enter Exit to exit DiskPart.

  9. Complete the Windows 7 installation. When prompted to select a disk, select the 40 GB disk you created with DiskPart to install Windows 7 on the VHD file. When you select the VHD disk file, the installation program presents a message telling you that "Windows cannot install to this disk." Don't believe it. It will.

Now you have a multiboot system. If desired, you can modify the boot configuration data (BCD) store to modify the boot options.

If you boot into Windows 7 normally, you'll see the file named MasterWin7.vhd at the root of C. If you want to use this image for any type of testing, first make a backup of this file. You can do so by simply copying the file. If future actions corrupt the file, you can copy the original back. Note that any data you store on this image will be lost if you haven't backed up the data somewhere else.

Converting a Regular Installation to a VHD File

It's often valuable to convert a full operating installation into a VHD. Using the different VHD tools, you can easily create snapshots and roll back all changes to an installation, but this simply isn't possible with a regular installation.

For example, you may want to test the effect of an upgrade on a live system. You can create the VHD, apply the upgrade, and then perform testing. Once you've completed the testing, you can undo the changes to the VHD file to return it to the pre-upgrade status.

Mark Russinovich and Bryce Cogswell have written several utilities for Sysinternals, including one named Disk2vhd that you can use to create a VHD version of a physical disk. In other words, you can have a regular version of Windows 7 running and then use this tool to create a VHD file. You can then use the VHD file with Windows Virtual PC or Microsoft's Hyper-V virtual program.

Other  
  •  Windows 8 : Scheduling Maintenance Tasks - Viewing and Managing Tasks on Local and Remote Systems
  •  Windows 8 : Detecting and Resolving Windows 8 Errors - Using the Event Logs for Error Tracking and Diagnosis, Viewing and Managing the Event Logs
  •  Windows 8 : Using Remote Assistance to Resolve Problems
  •  Windows 8 : Managing Automatic Updates
  •  Windows 8 : Managing Installed and Running Programs (part 3) - Configuring AutoPlay Options, Adding and Removing Windows Features
  •  Windows 8 : Managing Installed and Running Programs (part 2) - Managing the Command Path, Managing File Extensions and File Associations
  •  Windows 8 : Managing Installed and Running Programs (part 1) - Managing Currently Running Programs, Managing, Repairing, and Uninstalling Programs, Designating Default Programs
  •  Windows 8 : Deploying Applications Through Group Policy, Configuring Program Compatibility
  •  Windows 8 : Installing Programs - Working with Autorun, Application Setup and Compatibility, Making Programs Available to All or Selected Users
  •  Windows 7 : Windows Management and Maintenance - Additional Tools
  •  
    Top 10
    Extending LINQ to Objects : Writing a Single Element Operator (part 2) - Building the RandomElement Operator
    Extending LINQ to Objects : Writing a Single Element Operator (part 1) - Building Our Own Last Operator
    3 Tips for Maintaining Your Cell Phone Battery (part 2) - Discharge Smart, Use Smart
    3 Tips for Maintaining Your Cell Phone Battery (part 1) - Charge Smart
    OPEL MERIVA : Making a grand entrance
    FORD MONDEO 2.0 ECOBOOST : Modern Mondeo
    BMW 650i COUPE : Sexy retooling of BMW's 6-series
    BMW 120d; M135i - Finely tuned
    PHP Tutorials : Storing Images in MySQL with PHP (part 2) - Creating the HTML, Inserting the Image into MySQL
    PHP Tutorials : Storing Images in MySQL with PHP (part 1) - Why store binary files in MySQL using PHP?
    REVIEW
    - First look: Apple Watch

    - 3 Tips for Maintaining Your Cell Phone Battery (part 1)

    - 3 Tips for Maintaining Your Cell Phone Battery (part 2)
    VIDEO TUTORIAL
    - How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 1)

    - How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 2)

    - How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 3)
    Popular Tags
    Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS