Servers

Achieve quick, uniform server farm deployment with Windows imaging tools

This simple do-it-yourself approach to server image deployment offers low-overhead efficiency and consistent configuration.

 

lead image
 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

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

  1. 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.
  1. 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.
  2. 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.
  3. Run the "c:\windows\system32\sysprep\sysprep.exe" utility on the source server with the OOBE, Generalize, and Shutdown options.
  4. Boot the source server to Windows Server installation media, such as Windows Server 2008 R2 setup.
  5. 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.
  6. Select options to Repair My Computer in Windows Server setup.
  7. Choose Command Prompt or press F10 to open a command prompt window.
  8. 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.
  9. Boot the source server, allow it to finalize setup, and configure the server for network access.
  10. Copy the .WIM files off the source server C: drive to a network staging area where your ISO creation utility can work on them.
  11. Create a new .ISO image with the .WIM files of the Windows and system partitions in it.

Steps to deploy a server image

  1. Boot a target server to Windows Server installation media, such as Windows Server 2008 R2 setup.
  2. 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.
  3. Select options to Repair My Computer in Windows Server setup.
  4. Choose Command Prompt or press F10 to open a command prompt window.
  5. Run DISKPART with a script input to partition and format the target server hard disk to match the disk layout on the source server.
  6. Switch out the ISO media: From Windows Server setup to the ISO image with the WIM images inside.
  7. Use ROBOCOPY to copy the WIM files to the C: drive of the target server.
  8. 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.
  9. 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:

  1. After booting the server, open a command prompt and run the script.
  2. 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:





About

John Joyner, MCSE, CMSP, MVP Cloud and Datacenter Management, is senior architect at ClearPointe, a cloud provider of systems management services. He is co-author of the "System Center Operations Manager: Unleashed" book series from Sams Publishing, ...

3 comments
Pert_ve
Pert_ve

Its posible to prepare on a virtual machine an image of a server with AD included, users, policies, roles, services, all configured to deploy the image in a physical server? If I can do so, may I use sysprep or avoid it?


Thanks

viProCon
viProCon

Is there a reason to think this process can't be performed exactly for desktop client deployments?  I have never used tools like this nor done any real imaging deployments before so I admit even your "simple list looks like it's a lot more involved than you let on.  I don't work with mass server deployments but having a quick way to redeploy a client system would be very handy - every time a system gets infected or has some other undesirable software issue I can just toast it with an image - if it's as doable as this all sounds? 

John Joyner
John Joyner

@viProCon For sure you can use with PCs. The steps are the same: Once you get that "image" captured, and the .WIM file(s) on an .ISO: you can boot to Windows Setup DVD, open a command prompt, run the script, switch the ISO's when prompted, and boom--the PC is ready to go.  Once you get familiar with the tools and features, you may find an even simpler way to get the image on your PC hard disks. There are also commercial products similar to Norton's famous "Ghost" product that 'make it even simpler', but again, the point of the article is to share a 'free' way to do it.

Editor's Picks