Using ImageX to capture and deploy an image: a basic example
In this post I’ll go through a basic example of capturing and deploying a system image using ImageX:
- Sysprep the reference computer
- Capture an image of the reference computer
- Deploy the image to the target computer
Please keep in mind that this is just a basic example to give you an idea of how to utilize these tools. The configuration of your network and the unique factors in your environment will likely require you to modify several of the details I provide in the steps below.
In the interest of keeping this somewhat complicated topic short I am assuming you (the reader) already have the basic skills to:
- Load and customize a Microsoft Operating System
- Create a network share to store images
- Utilize the command line
- Create a boot-able disc
- Modify the boot sequence of a computer
To utilize ImageX and complete the steps below you will require a Windows PE disk with ImageX.
If you need to create one, you will first need to download the The Windows AIK.
Once installed here are two resources you can utilize to assist you in creating your disc:
- Create WinPE boot disk with ImageX – Video
- Create a Bootable Windows PE Disk – Spiceworks article
Step 1: Load and customize the reference computer
The reference computer is your model from which to create your customized image. Set it up how you like (ie programs, drivers, etc) – just keep in mind that sysprep will remove certain elements depending on which switches you utilize in the command.
Step 2: Sysprep the reference computer
If you would like to customize the sysprep process, create an unattend.xml file and place it in: C:\windows\system32\sysprep
For instance, I typically create images for a specific platform. Because I will be deploying the image to identical devices I don’t want sysprep to strip out the drivers I’ve installed.
So, I create a custom unattend.xml file that tells sysprep to keep the drivers:
<settings pass="generalize"> <component name="Microsoft-Windows-PnpSysprep"> <PersistAllDeviceInstalls>true</PersistAllDeviceInstalls> </component> </settings>
Run sysprep from the command line. This will sysprep the reference computer and shut it down, allowing you to then boot it up from your Windows PE disk with ImageX and capture an image.
C:\Users\*User*> C:\Users\*User*>cd c:\windows\system32\sysprep C:\Windows\System32\Sysprep>sysprep.exe /oobe /generalize /shutdown /unattend:unattend.xml
Step 3: Use ImageX to capture the image
Boot the reference computer into the WindowsPE environment.
Please note that while it is possible to place ImageX onto the root of your WindowsPE disc I prefer to place it into a separate Tools folder. This is reflected in the example below.
In the example below we will switch to the drive containing our WindowsPE disc and then to the directory containing ImageX. We then use net use to connect to a network share to store the image on. Alternatively you could use an external hard drive to capture the image. We then run ImageX to capture the image of the reference computer.
X:\windows\System32> X:\windows\System32>d: D:\>cd Tools D:\Tools>net use n: \\server\share /user:Domain\username "password" D:\Tools>imagex /capture /flags "professional" c: n:\images\win7x64_pro.wim "Win7Pro"
Step 4 (optional): Prepare the hard drive of the target computer to receive the image
Dependent on your situation you may need to prep the hard drive of the target computer. This can be accomplished using DISKPART. Boot the target computer using your WindowsPE disc and follow the commands below. This will erase the drive and format it to receive the image. If your target drive is already formatted appropriately you can skip this step.
X:\windows\System32> X:\windows\System32>d: D:\> D:\>diskpart DISKPART>list disk DISKPART>select disk (id) DISKPART>online disk (if the disk is not online) DISKPART>clean DISKPART>convert mbr (or gpt) DISKPART>create partition primary DISKPART>select part 1 DISKPART>active (if this is the boot partition) DISKPART>format fs=ntfs label=(name) quick DISKPART>assign letter c: DISKPART>list volume DISKPART>exit
Step 5 : Deploy the image to the target computer using ImageX
Boot the target computer into the WindowsPE environment.
In the example below we will switch to the drive containing our WindowsPE disc and then to the directory containing ImageX. We then use net use to connect to a network share where the image is stored. We then run ImageX to deploy the image to the target computer.
D:\Tools> D:\Tools>net use n: \\server\share /user:Domain\username "password" D:\Tools>imagex /apply n:\images\win7x64_pro.wim "Win7Pro" c:
Once complete you can reboot the target computer and it should boot into Windows.
Occasionally I have seen an error during this process on the first boot. Errors might include:
- cannot find NTLDR
- winload.exe not found
- other general boot failures
If you experience this, reboot back into you WindowsPE environment and run the command below. Your target PC should now work fine.
X:\windows\System32>c: C:\>c:\windows\system32\bcdboot c:\windows /s c:
If you would like to experiment more and further customize your ImageX uses, I recommend the book below. It is a great resource for all the various switches, commands, and proper syntax structures.
Windows 7 Portable Command Guide
Thank you for the guide. I am trying to use imageX on a computer that has RAID 10 in use. However, whenever I boot the computer from my WindowsPE UFD, I cannot see the hard drive, I only see the UFD. Even though RAID 10 is in use, it is still one logical drive. When I go to diskpart and type list disk or list volume, only my UFD shows up.
Another question, where do I put the unattend.xml file that I want to attach to the sysprep? On the desktop?
Thank you
I’m assuming you are using hardware RAID.
Diskpart should be able to see it when using the list disk command if the RAID is configured correctly.
If you pop in a Windows Disk with the appropriate F6 RAID drivers can Windows see the array?
What drive letter are you running Diskpart from in your setup?
Take a look around here as well:
A Description of the Diskpart Command-Line Utility
Troubleshooting Disk Management
Thanks for the steps….Can you clarify some things for me please?
Is it possible to use imagex without sysprep? I’m trying to copy over a HyperV-based Win7 image to a physical PC using imagex but it always bluescreens immediately at startup, so I’m guessing not. Was hoping to avoid using an instance of sysprep due to its 3 limit feature, and call sysprep once the generic image was actually on the physical PC.
Windows typically has two partitions these days; Windows itself (typically drive C) and the hidden 100-350mb recovery partition. Don’t you have to imagex capture the recovery partition as well?
–Yes, but not recommended.
–You should check out the following link regarding this:
https://social.technet.microsoft.com/Forums/windowsserver/en-US/405e28ea-4307-40cf-8ef7-2e07d4c07cf7/how-to-convert-hyperv-vm-to-physical-machine
–No you do not. The very end of my article discusses how to regenerate and repair when this causes problems.
Will this software work well with Win7 Pro and a RAID 1 configuration?
We have 2 SSD’s in a RAID 1 config. Basic install of Windows with all updates installed and our POS software installed as well.
thanks
Hey Chef,
Shouldn’t be an issue, the WinPE should see the RAID 1 config as just a normal drive.
If not, I would check out this article:
RAID disk not seen from WInPE boot
Is possible to skip startup language , keyboard layout option in image.
How to skip?
Thank you for this guide. Unfortunately, this does not allow Bitlocker to encrypt the hard drive with a captured image. It wants the partition used to boot and recover to be separate from the OS. How do I format it to allow bitlocker encryption to simply work?