How exactly do you get into a Windows Vista install image (WIM file) and make modifications? I've put together a step-by-step guide with screenshots on how to use Vista's ImageX tool.
Our recent articles on Vista’s new file-based imaging format - WIM attracted unexpectedly huge interest from around the world. Clearly there's a bit of pent up frustration out there with the difficulty of modifying the XP install CD and deploying images.
To recap briefly, Vista's new disk image technology is the basis of all Vista installations. The Vista install DVD is, in fact, just a preinstalled copy of Vista in a disk image. This offers the huge advantage that you can open up modify your Vista install DVD as if Vista were already installed on a PC.
But how exactly do you get in there and modify it? As with most new technologies, you need to know about some specific tools that won't come with Vista in the box.
To open and modify a WIM file, the core tool is ImageX, which is part of the Windows Automated Installation Kit (WAIK).
Unfortunately WAIK isn't yet available for public download -- it is only available to Microsoft-invited formal beta testers of Vista. However, we suspect it will be publicly available soon.
Given the huge interest in it, Microsoft would be crazy to restrict it to corporate customers, or charge a fee for it.
How to install Windows Automated Installation Kit (WAIK)
ImageX runs through the WIMFLTR.SYS driver. This allows WIM file to be mounted into the current Windows Explorer file system, and lets you interact with the contents of the WIM as if they were files on the local system.
On my test system (Windows XP SP2) I had an installation of WAIK and a copy of the INSTALL.WIM from the latest Vista beta (5472) stored in C:\Temp.
To get ImageX running, I had to install WIMFLTR.SYS first, so I navigated to C:\Program Files\Windows AIK\Tools\x86, right-clicked on WIMFLTR.SYS and selected Install. The SYS and appropriate DLLs were then copied across and the filter driver was activated.
How to run ImageX
IMAGEX.EXE isn’t covered by the path environment variable in Windows, so you'll have to navigate directly to the file location to run it.
ImageX is a command-line program, so to get to it, you need to open up a Command Window, change directory (CD) to C:\Program Files\Windows AIK\Tools\x86 and type in “imagex”.
Command line parameters for ImageX
Like most command-line programs, ImageX requires a number of parameters to work properly, so running it without parameters displays all the options available.
(Click to see a full-resolution view in a new window)
ImageX has 11 commands - APPEND, APPLY, CAPTURE, DELETE, DIR, EXPORT, INFO, SPLIT, MOUNT, MOUNTRW and UNMOUNT.
Typing in “imagex /command /?” where “command” is the action you’re interested in will display more details about that particular command.
Getting info about a WIM image
So in this case I was interested in looking at the details of a WIM file and I wanted to know the syntax of the INFO command.
I typed “imagex /info /?” and the output gave me details of how to use INFO.
To take a look at the WIM file I had available, I typed in “imagex /info c:\temp\install.wim” - the output displays all the information particular to that WIM file.
(Click to see a full-resolution view in a new window)
(Click to see a full-resolution view in a new window)
As you can see from the screenshot, WIM data is pretty much all XML.
This is one of the big benefits of WIM - installs can be scripted using the same data across different platforms, because the XML can be adapted to any situation. The impact is we won’t have the current situation where installs of Windows XP need different scripts depending on the distribution method - RIS, SYSPREP, SETUP.EXE and so on.
Viewing the contents of a WIM image
Then I wanted to mount the image and have a look through it.
I created a folder called C:\Temp\Image and mounted the WIM there using "mountrw" parameter on imagex. “imagex /mountrw /?” gives details on the correct syntax, which in this case is “imagex /mountrw c:\temp\install.wim 1 c:\temp\image”.
MOUNTRW is needed to make changes to the WIM, otherwise MOUNT will mount the image in read-only mode.
“1” is specified as that is the image part number of the image contained within the WIM - INFO gave me that detail.
The image was mounted successfully, and when I navigated to C:\Temp\Image, the contents of the image were displayed and I could navigate them like any other file system -- even using Windows Explorer.
(Click to see a full-resolution view in a new window)
(Click to see a full-resolution view in a new window)
Adding new stuff to your Vista image
From here you can do pretty much anything - inject drivers, slipstream service packs or patches, place custom files, MSI packages … whatever. (We'll cover more of the specific methods for doing this in an upcoming article.)
If you do make any changes though, you need to commit those changes before unmounting the image.
By default, any changes you make are queued up in a temporary location and not written to the image. That way you have a way to gracefully back out if things go wrong.
To unmount the image, you just type in “imagex /unmount c:\temp\image” or “imagex /unmount /commit c:\temp\image”.
And it’s that easy. ImageX is an awesome tool - incredibly simple and powerful. It’s going to make modifying Vista installs an absolute breeze.
LINKS
RELATED ARTICLES