Share via


Steps for Creating Windows 7 Images

Requirements:

2 Computers (Computer 1 is for writing answer file and Computer 2 is for creating and mounting the image)

WAIK (Windows Automated Installation Kit) software: The Windows® Automated Installation Kit (Windows AIK) is a set of tools and documentation that support the configuration and deployment of Windows® operating systems. By using Windows AIK, you can automate Windows installations, capture Windows images with ImageX, configure and modify images using Deployment Imaging Servicing and Management (DISM), create Windows PE images, and migrate user profiles and data with the User State Migration Tool (USMT).

Windows 7 Installation DVD (64 or 32 bit): In this document we will be using Win 7 64 bit.

External Hard Disk

Win PE (Windows Preinstallation Environment) CD

Process Involved:

Create an Answer File

Build a Windows PE Boot Disk

Create the SYSPREP Image

Capture the Image

Mount a WIM

Create an Answer File:

1) Install WAIK software on computer 1. If you have the WAIK DVD insert it to the computer, open the DVD and navigate to en-us and click on startCD.exe to run it on the computer and proceed to step 2, otherwise follow the steps below to create a WAIK DVD: 

To install the Windows AIK, you must first download the ISO, Write the ISO file to a DVD using a third party tool, and then install the Windows AIK from the DVD. In this case we are using ImgBurn to burn the ISO file.

a) Insert an empty DVD into the computer 1. Now open a browser and go to http://www.microsoft.com/en-ca/download/details.aspx?id=5753 . Click download and save it to your desktop.

b) Again open a browser and go to http://www.imgburn.com/index.php?act=download and click Mirror 7 – Provided by ImgBurn which will download a setup file on to your browser. Once it is done run it and open ImgBurn software.

c) Click on Write image file to disc under “What would you like to do”.

d) You will get another window where you have to select the file and choose the destination which will be your DVD and then burn it.

e) Now you have the WAIK DVD. Follow step 1 to install WAIK.

2) Next, insert your Windows 7 installation DVD into the system.

3) Launch Windows System Image Manager (which is located on the start menu under All Programs/Microsoft Windows AIK/Windows System Image Manager).

4) Under the Windows Image header right-click on “Select a Windows image or catalog file” and choose the “Select Windows Image” command from the shortcut menu. The system will prompt you to select a Windows Image. Use the browse window to navigate to the Windows 7 installation DVD sources folder and select the INSTALL.WIM file.

Depending on where you got your Windows 7 installation DVD, you might see a prompt asking for which version of Windows you want to manage. Select the appropriate version and click OK.

5) The next step is to create an answer file. Go to the file menu and select “New Answer File”. Next choose the “Save Answer File” command from the file menu. This will prompt you to name the file and save it to a location. Name the file as “Unattended.xml” and save it to your own preferred folder or destination. When you do, the Windows System Image Manager should display both the Windows image at the left bottom and the answer file on the center of the WSIM window.

6) Now under the answer file you will see two categories listed, components and packages. Under the components folder you see that we have 7 options:

-1 windowsPE

-2 offlineServicing

-3 generalize

-4 specialize

-5 auditSystem

-6 auditUser

-7 oobeSystem

The next steps are very important as you are going to add the components from “Windows Image” section on the left bottom to the components on your answer file. Among the above 7 components in the answer file you are only going to sequence the following components:

-3 generalize

-4 specialize

-7 oobeSystem

7) Generalize:  In this step you are going to move the security-spp component from “Windows Image” to “3 generalize” under your answer file.

Expand components under “Windows Image” and look for the following

amd64_Microsoft-Windows-Security-SPP_6.1.7601.17514_neutral

a) Right click on it and click “Add Setting to Pass 3 generalize”.

b) Now on your answer file you will see the component got added to “3 generalize”.

c) Next on the right side you will see 3 properties (Properties, Id and Settings) of the added component. Under them expand “Settings” and set the SkipRearm to 1 (By setting this from 0 to 1 will allow up to 8 rearms).

8) Specialize: In this step you are going to move the deployment, security-spp-UX and shell-setup components from “Windows Image” to “4 specialize” under your answer file.

Expand components under “Windows Image” and look for the following

amd64_Microsoft-Windows-Deployment_6.1.7600.16385_neutral

Right click on it and click “Add Setting to Pass 4 specialize”. Now on your answer file you will see the component got added to “4 specialize”.

a) Next expand amd64_Microsoft-Windows-Deployment_neutral under “4 specialize”

b) Right click on “RunSynchronous” and click “Insert New RunSynchronousCommand”.

c) Next on the right side under “Settings” set the following values alone and leave the other as blank

Order: 1

Path: net user administrator /activity:yes

WillReboot: Never (This value should be there already)

d) Now you will see that “RunSynchronousCommand” renamed to “RunSynchronousCommand[Order=”1”]”.

Expand components under “Windows Image” and look for the following

amd64_Microsoft-Windows-Security-SPP-UX_6.1.7601.17514_neutral

a) Right click on it and click “Add Setting to Pass 4 specialize”.

b) Now on your answer file you will see the component got added to “4 specialize”.

c) Next on the right side under “Settings” set the following value

SkipAutoActivation: true

Expand components under “Windows Image” and look for the following

amd64_Microsoft-Windows-Shell-Setup_6.1.7601.17514_neutral

a) Right click on it and click “Add Setting to Pass 4 specialize”.

b) Now on your answer file you will see the component got added to “4 specialize”.

c) Next on the right side under “Settings” set the following values alone and leave the other as blank

CopyProfile: true

ShowWindowsLive: false

TimeZone: Eastern Standard Time (You can set this depending on your location)

9) OobeSystem: In this step you are going to move the international-core and shell-setup components from “Windows Image” to “7 oobeSystem” under your answer file.

Expand components under “Windows Image” and look for the following

amd64_Microsoft-Windows-International-Core_6.1.7600.16385_neutral

a) Right click on it and click “Add Setting to Pass 7 oobeSystem”.

b) Now on your answer file you will see the component got added to “7 oobeSystem”.

c) Next on the right side under “Settings” set the following values alone and leave the other as blank

InputLocale: en-us

SystemLocale: en-us

UILanguage: en-us

UserLocal: en-us

Expand components under “Windows Image” and look for the following

amd64_Microsoft-Windows-Shell-Setup_6.1.7600.16385_neutral

a) Right click on it and click “Add Setting to Pass 7 oobeSystem”.

b) Now on your answer file you will see the component got added to “7 oobeSystem”.

c) Next on the right side under “Settings” set the following values alone and leave the other as blank

RegisteredOrganization: Your Company name

RegisteredOwner: Your name

d) Expand amd64_Microsoft-Windows-Shell-Setup_neutral and select AutoLogon. Next on the right side under “Settings” set the following values:

Domain: Your domain

Enabled: true

LogonCount: 5

Username: administrator

Now expand AutoLogon and select Password. On the right side under “Settings” type your administrator password to set the value.

Close the AutoLogon

e) Next right click FirstLogonCommands under amd64_Microsoft-Windows-Shell-Setup_neutral and click “Insert New SynchronousCommand”.

On the right side under “Settings” set the following values alone and leave the other as blank:

CommandLine: cscript //b c:\windows\system32\slmgr.vbs /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX (Windows 7 license key)

Order: 1

RequiresUserInput: false

Now the SynchronousCommand under FirstLogonCommands will be renamed to “SynchronousCommand[Order=”1”]”.

We have to create another SynchronousCommand. So right click FirstLogonCommands under amd64_Microsoft-Windows-Shell-Setup_neutral and click “Insert New SynchronousCommand”.

On the right side under “Settings” set the following values alone and leave the other as blank:

CommandLine: cscript //b c:\windows\system32\slmgr.vbs /ato

Order: 2

RequiresUserInput: false

Now the new SynchronousCommand under FirstLogonCommands will be renamed to “SynchronousCommand[Order=”2”]”.

Close FirstLogonCommands

f) Next click on OOBE and on the right side under “Settings” set the following values alone and leave the other as blank:

HideEULAPage: true

NetworkLocation: Home

ProtectYourPC: 1

g) Expand UserAccounts and click AdministratorPassword. Set the administrator value on the right side under “Settings”.

Now right click LocalAccounts under UserAccounts and click on “Insert New LocalAccount”. On the right side set the following values:

Description: Local Administrator

DisplayName: Administrator

Group: Administrators

Name: Administrator

Now the LocalAccount under “LocalAccounts” will be renamed to “LocalAccount[Name=”Administrator”]

10) Now save your file and close WSIM as we are done with the Answer file creation stage.

Build a Windows PE Boot Disk

You’ll eventually use the answer file you’ve just created to prepare a Sysprep Windows image. The problem with doing that, however, is that once you Sysprep a PC, you’ll need a way to copy the image off the PC from outside the main OS. The easiest way to do this is to build a Windows PE boot disk.

1) To create a Windows PE boot disk, open an elevated Command Prompt window and enter the following commands:

C:

CD\PROGRAM FILES\WINDOWS AIK\TOOLS\PETOOLS

COPYPE AMD64 C:\WINPE

IMAGEX /MOUNTRW C:\WINPE\WINPE.WIM 1 C:\WINPE\MOUNT

CD\WINPE\MOUNT\WINDOWS\SYSTEM32

COPY CON WIMSCRIPT.INI

The above command sequence creates a file in the C:\winpe\mount\windows\system32 folder called WIMSCRIPT.ini

2) Once you’ve created the WIMSCRIPT.INI file, run the following commands:

IMAGEX.EXE /UNMOUNT /COMMIT C:\WINPE\MOUNT
CD\WINPE
COPY WINPE.WIM C:\WINPE\ISO\SOURCES\BOOT.WIM /Y
OSCDIMG –N –H –BC:\WINPE\ETFSBOOT.COM C:\WINPE\ISO C:\WINPE\WINPE.ISO
  1. These commands will write a file called WINPE.ISO to the C:\WINPE folder. Burn this file to a DVD. This is your Windows PE boot disk.

Now that you’ve created both an answer file and a Windows PE boot disk, it’s time to create the actual deployment image. Install Windows 7 onto a spare PC.

Create the SYSPREP Image

1) Now turn on your computer 2 (spare computer) and enter BIOS setting by clicking F1 key. Once you are there change the primary boot sequence to DVD. Insert your Windows 7 DVD into the computer and press F10. Rapidly click “ENTER” when you see the message” Press any key to boot from CD” and proceed with the installation.

2) When you get to the point during installation when you’re asked to provide your name and a name for the computer, press Crtl+Shift+F3 instead of entering the requested information. This will force Windows to reboot into audit mode.

3) When the system boots, you’ll see a Sysprep dialog box. Cancel the dialog box and remove the Windows 7 DVD from your CD ROM.

Now begin adding the software’s required for your business. It’s OK if any of the applications you’re installing require a reboot, because the system will boot back into audit mode.

4) When you’ve finished configuring this PC, it’s time to bring in the answer file from computer 1 that you created earlier. Copy the answer file to the C:\Windows\System32\sysprep folder and rename it to “Unattended”.

Keep in mind that the answer file you created probably contains sensitive information. You don’t want this information copied to other desktops set up with this deployment image you’re creating, so you need to create a script to get rid of the answer file when it’s no longer needed (don’t forget to make a copy of the answer file for yourself first).

5) Create a folder named C:\Windows\Setup\Scripts. Create a text file within that folder named SetupComplete.cmd. Add the following commands to this file:

Delete /Q /F C:\Windows\system32\sysprep\unattended.xml
Delete /Q /F C:\Windows\panther\unattended.xml
  1. When you’re done configuring the system and creating the script to get rid of the answer file, connect your external hard disk to the computer. Open your external hard drive and create a folder called “Images”. The open Images and create a sub folder called “Offline”.

7) Next we need the Windows deployment tools from WAIK to be copied on to the hard disk.

(Imagex file is to capture the image and servicing folder is to mount the image using DISM).

So copy the file “Imagex.exe” and the folder “servicing” from your computer 1 and paste it on to your hard disk. The files should be under the path C:\Program Files\Windows AIK\Tools\amd64.

8) Insert the WinPE disk to the computer that you created earlier.

9) Now you’re ready to run Sysprep. Open an elevated Command Prompt window and enter the following command:

SYSPREP  /GENERALIZE  /OOBE  /SHUTDOWN  /UNATTEND:UNATTENDED.XML

When you run this command, Sysprep will generalize the system to deploy your configuration to other systems. When it finishes, the system will shut down. Don’t turn the computer back on until you read the next section.

Capture the Image

Now that you’ve Sysprepped the system, you must capture the computer’s current state. Because booting the computer into Windows will ruin the generalization you’ve just performed, you need to boot the system using the Windows PE boot disk.

1) Now turn on the computer and keep pressing F1 Key to enter BIOS settings. Make sure the primary boot sequence is set to DVD and press F10 key. The system should reboot.

2) Next rapidly click “ENTER” when you see the message” Press any key to boot from CD” and wait for the WinPE environment.

3) Once you are in WinPE type 3 and enter to command line.

4) Run the following command:

Type G: and click enter to go in to G: and then type the following

Imagex  /capture  D:  G:\Images\captured.wim  “Windows  7  64”

[G: is the external hard disk, D: is the one that has the image and answer file. This may differ in each case depending on your environment.]

5) Now the capturing process should start and it goes anywhere between 3 to 4 hours. Once the process is done exit out of WinPE, remove the CD and restart the computer.

Mount a WIM

Now that you’ve created your image, you may need to add drivers, add or remove Windows features, or perform any other management tasks. You can do this with a tool included in the Windows AIK called the Deployment Imaging Service and Management Tool. This DISM is located under the servicing folder in the hard disk that you copied over previously.

This process involves mounting the Image, adding drivers to the Image and unmounting the Image.

On your hard disk create a folder called “Extracted-Drivers” and move the extracted drivers to this folder from your source location.

1) Open an elevated command prompt window (which is opening the command prompt by right clicking “Run as Administrator”).

2) Now enter the following commands to fetch the name of the Wim file which we eventually need it to mount the image.

CD DISM

Dism  /Get-WimInfo  /WimFile:F:\Images\captured.wim   and press enter.

[Here F: is the hard disk and this will provide you the Wim file name and make a note of it as it is.]

3) Now type the following command the mount the image:

**Dism  /Mount-Wim  /WimFile:F:\Images\captured.wim  /Name:”Windows 7 64”  /MountDir:F:\Images\Offline

**

4) Once the mounting process is done type the following command to add the drivers:

**Dism  /Image:F:\Images\Offline  /Add-Driver  /Driver:F:\Extracted-Drivers  /Recurse

**

5) Once the drivers are added, enter the following command to unmount the Image.

Dism  /Unmount-Wim  /MountDir:F:\Images\Offline  /Commit

6) Once unmounting is done, the Image file is ready and you can use this to install Windows.


References:

http://technet.microsoft.com/en-us/magazine/hh241307.aspx  - Windows 7: Deploying Windows 7

http://theitbros.com/sysprep-a-windows-7-machine-%E2%80%93-start-to-finish/  - Sysprep Windows 7 Machine start to Finish

http://blog.getspool.com/176/download-use-sysprep-windows-7/ - How to use Sysprep for Window 7

http://technet.microsoft.com/en-us/library/dd744355(v=ws.10).aspx  - Add and Remove Drivers Offline