Do you have a few dozen identical physical computers to deploy
at once on your network? You want to avoid manually installing and configuring
each server. Not only is this much more time consuming than necessary, it
introduces the opportunity for subtle differences between server builds that
can haunt you when troubleshooting network issues in the future. The total cost
of ownership (TCO) of a server “farm” is lower when all servers are
deployed from the same physical server image.
Large and small scale approaches to server imaging
This article covers a lightweight but effective way to use
Windows imaging tools, with some simple scripting and light human touch, to
achieve the desired goals of rapid and uniform server deployment. On a larger
scale, if you are a data center operator and have hundreds or thousands of
servers to deploy, your best solutions will involve delivering high-volume
server images over the network, as in “Press F12 to boot to the network”
following server POST (Power On Self-Test). PXE Servers respond to the network
boot request and deliver a boot image without physical media.
Large scale server image delivery solutions often involve
Pre-boot Execution Environment (PXE) technology. Microsoft’s System Center
Virtual Machine Manager (SCVMM) solution for data center fabric management uses
PXE servers to deploy an operating system (OS) onto dozens or hundreds of
physical hardware hosts at once. However, a PXE-based solution can be overkill
to stand up for ad-hoc deployment scenarios of a handful to a few dozen
servers.
A simple do-it-yourself approach to server image deployment
that requires little overhead to stand up leverages:
- Bootable Windows Server installation physical media and
- The ImageX or DISM (Deployment Image Servicing and
Management) utilities from Microsoft’s Windows Automated Installation Toolkit
(WAIK) or Windows Assessment and Deployment Kit (ADK) on removable media
Using this methodology, you can cut the time needed to
deploy a production-ready server down to a half hour or so and repeat that
dozens or hundreds of times without deviation. Figure A shows a new server “waking
up” after an image has been deployed.
Figure A
Windows Server image executes
device discovery during first boot on a target computer.
The only third-party tool you will need is a utility to
create .ISO files (DVD image format) containing the files to capture and deploy
the server OS image, as well as the image files themselves. This is actually a difficult
feature to find in quality freeware, but I found CD BurnerXP to be a great tool for this
job. You also need a way to mount ISO files in your physical server boot
environment. That means local access to a server with a few USB ports–or Out
of Band (OOB) remote access, such as via HP Lights-Out (iLO) or Dell DRAC card
with remote media features.
Steps to capture a server image
- Install the WAIK or ADK on any server to make
the ImageX or DISM utilities available.
- ADK is the newer version that includes DISM;
however, the ImageX utility in the earlier WAIK works fine too.
- Links to Microsoft references for the details on
these steps using either ImageX or DISM are at the end of this article.
- Make an ISO file image that includes the ImageX
or DISM tools. You don’t need WinPE or other PXE features enabled. Format or
place the ISO image (on removable media or a remote media file system) so it
will be available to the computer at boot time. - Install and configure the roles, features,
drivers, and utilities that will be needed for the server farm on a model
computer, known as the “source” server. - Run the “c:\windows\system32\sysprep\sysprep.exe”
utility on the source server with the OOBE, Generalize, and Shutdown options. - Boot the source server to Windows Server
installation media, such as Windows Server 2008 R2 setup. - Make the ISO image with the ImageX or DISM tools
available to the source server, such as by attaching a USB key or OOB remote
media. - Select options to Repair My Computer in Windows
Server setup. - Choose Command Prompt or press F10 to open a
command prompt window. - Run the ImageX or DISM tool with options to
capture the Windows and system partitions to .WIM (Windows Image files) on the
C: drive of the source server. - Boot
the source server, allow it to finalize setup, and configure the server for
network access. - Copy
the .WIM files off the source server C: drive to a network staging area where
your ISO creation utility can work on them. - Create
a new .ISO image with the .WIM files of the Windows and system partitions in
it.
Steps to deploy a server image
- Boot a target server to Windows Server installation media,
such as Windows Server 2008 R2 setup. - Make the ISO image with the ImageX or DISM tools available
to the target server, such as by attaching a USB key or OOB remote media. - Select options to Repair My Computer in Windows Server
setup. - Choose Command Prompt or press F10 to open a command prompt
window. - Run DISKPART with a script input to partition and format the
target server hard disk to match the disk layout on the source server. - Switch out the ISO media: From Windows Server setup to the
ISO image with the WIM images inside. - Use ROBOCOPY to copy the WIM files to the C: drive of the
target server. - Run the ImageX or DISM tool with options to deploy the
Windows and system partitions from .WIM (Windows Image files) on the C: drive
of the target server. - Boot the target server; it will execute post-Sysprep device
discovery and be ready to use in a few minutes.
Sample scripts
You will have a primary script (command file) that calls an
input file for the DISKPART utility. The script and input file can be stored on
the same removable media as the ImageX (or DISM) utility. Here is a sample
primary script:
DISKPART /s InputFile.txt
echo Switch ISOs now!
Pause
ROBOCOPY D: C: /V
Imagex.exe /APPLY C:\my-windows-partition.wim 1 C:\ /check /verify
Imagex.exe /APPLY C:\my-system-partition.wim 1 S:\ /check /verify
Here are the contents of a sample InputFile.txt:
select disk 1
clean
create partition primary size=110
format quick fs=ntfs label="System partition"
assign letter="S"
active
create partition primary size=238000
format quick fs=ntfs label="Windows partition"
assign letter="C"
exit
The complete procedure to deploy the image on a server takes
just two touches:
- After booting the server, open a command prompt and run the
script. - When prompted to “Switch ISOs now,” make the ISO
image with the .WIM files available and press any key.
Reference procedures
for capturing and deploying image files
Adapt the sample scripts to your environment using detailed
information at these links: