Windows 7 Image Deployment Demonstration

Before you start

Objectives: learn how to deploy existing Windows image to the new computer using ImageX tool, and other tools available in the WinPE.

Prerequisites: you have to have prepared WinPE media which you will use to boot your new computer from. In this article we will use Windows image which we have captured in the article Windows Image Capture Demonstration.

Key terms: partition, image, command, drive, system, imagex, winpe, diskpart, bcdboot


Boot Into WinPE

The first thing we need to do is boot our destination computer into WinPE using WinPE media that we created ourselves. We have inserted ImageX into WinPE root folder, so that we can use it when we boot into WinPE. Let’s boot our new computer using WinPE and check that we have ImageX available in the root folder. First we have to go to the root folder using ‘cd\‘ command, and then we will list directory items using the ‘dir‘ command.

Content of WinPE Media

Image 196.1 – Contetn of WinPE Media

Notice that the imagex.exe is available in the X:\ directory.

Prepare Hard Drive For Installation

Now, we need to prepare our hard disk for the installation. We will use Diskpart to partition and format the hard drive prior to installing the image. Microsoft recommends creating two partitions formatted with NTFS, 100 MB partitioned for BitLocker information and remaining space partitioned for the Windows 7 image. Let’s enter Diskpart and check available disks on our system using the list disk command.

Diskpart

Image 196.2 – List Disk Command in Diskpart

Notice that in our case we have one disk available, Disk 0. Let’s select it by entering ‘select disk 0‘ command. Then we are going to clean it by entering the ‘clean‘ command. Next, we are going to create new 100 MB partition for BitLocker by entering the ‘create partition primary size=100‘ command.

Creating Partition

Image 196.3 – Create Partition for BitLocker

Next, we will select that newly created partition using the ‘select partition 1‘ command, format it using the NTFS file system with the ‘format fs=ntfs label=”BitLocker”‘ command and assign a drive letter C to it using the ‘assignt letter=c‘ command.

Formating New Parition

Image 196.4 – Format New Partition

This partition will not be visible once we log on to our Windows 7. Letters assigned to partitions in Windows can be different from those assigned in Diskpart.

Next, let’s create second partition that will hold our Windows 7 system. We will enter the ‘create partition primary‘ command. Notice that we did not specify the size of the partition so diskpart will use all the remaining space for our partition. After the creation we can check our partitions using ‘list parition‘ command.

New Parition

Image 196.5 – Create Main Partition

Notice that now we have second partition which is 39 GB in size. Next, we will select that new partition, format it using NTFS, assign a drive letter to it and make it active. After that we can exit Diskpart.

Setting Up New Partition

Image 196.6 – Set Up New Partition

Connect to a Network Share

In our case we have put our prepared  Windows 7 image on a network share so we have to connect to it before we can use prepared image. We have our share available on ‘nx7300‘ computer. The share name is ‘shared-images‘. To connect to that share using ‘net use‘ command we have to provide valid credentials. We will map that share to the Z: drive. The command is ‘net use z: \\nx7300\shared-images‘. When providing user name we also have to provide computer name. So the user name in our case is ‘nx300\admin‘, because we will use credentials from the nx7300 computer in our case.

Net Use

Image 196.7 – Net Use Command

Network share is now available as Z drive. Let’s see it’s content.

Z Drive

Image 196.8 – Z Drive Content

Notice that we have win7.wim file available here. That is the Windows 7 image that we created earlier ourselves in our case.

Use ImageX to Apply Image

Now we can use ImageX tool on which is available on  the Windows PE medium to copy and apply the pre-made image to the local drive. Now, we have drive X: which is the drive containing the Windows PE medium, drive Z: containing the WIM file, and drive D: which is the local hard drive where the WIM file should be applied. In our case we will apply Windows 7 Enterprise which is the 1st edition in the WIM file. The whole command looks like this: ‘x:\imagex.exe /apply z:\win7.wim 1 d:\‘.

Image Applied

Image 196.9 – Image Applied Successfully

When this process is finished we need to configure our partition so that it can be used to start the computer. To do that we will use a command line tool called BCDBoot which is available in[drive]:\windows\system32\ folder. BCDBoot copies the necessary boot loader files to the partition. These files are the BOOTMGR program, which is responsible for locating available operating system installations and starting the operating system, and the Boot Configuration Data (BCD) store, which is a database that identifies possible operating systems and their locations on disk. The BCD store contains BCD entries, with each entry identifying a separate installation instance. The BCD store in Windows 7 and Vista is similar to the Boot.ini file in previous Windows versions. In our case the command will be ‘d:\windows\system32\bcdboot d:\windows‘.

BCDBoot

Image 196.10 – BCDBoot Command

Remember

The first thing we need to do is boot our destination computer into WinPE using WinPE media that we created ourselves. Next, we have to prepare our Hard Drive for installation (create partition on which we will apply image) using Diskpart). In our case our image is available on the network share, so we have to connect to it using the Net Use command. At the end we can use ImageX to apply the image to our computer.

Commands that are mentioned in this article
  • cd\ – return to the root directory
  • dir – list directory content

Diskpart commands:

  • diskpart – open diskpart tool
  • list disk – list all disks available on the system
  • select disk 0 – select disk with index number 0
  • clean – clean selected disk
  • create partition primary size=100 – create primary partition which is 100 MB in size
  • select partition 1 – select partition with index number 1
  • format fs=ntfs label=”BitLocker” – format selected partition with NTFS file system and apply label ‘Bitlocker’
  • assign letter=c – assign drive letter C to the selected partition
  • create partition primary – create primary partition using all available space
  • list partition – list all partitions available on the selected disk
  • select partition 2 – select partition with index number 2
  • format fs=ntfs label=”Win7″ – format selected partition with NTFS file system and apply label ‘Win7’
  • assign letter=d – assign drive letter D to the selected partition
  • active – mark selected partition as active

Connect to the network share:

  • net use z: \\nx7300\shared-images – map ‘\\nx7300\shared-images’ shared folder to the Z drive

ImageX command to deploy image:

  • x:\imagex.exe /apply z:\win7.wim 1 d:\ – use ImageX to apply win7.wim image (edition 1) to the D drive

Make new installation bootable:

  • d:\windows\system32\bcdboot d:\windows – use bcdboot tool to make our new installation bootable
Paths that are mentioned in this article
  • \\nx7300\shared-images – shared folder on the network which contains prepared Windows image
  • d:\windows\system32\bcdboot – location of the bcdboot tool