Custom Windows Vista Installation
If there is one thing that I’ve learned after working with Windows for 15 years is that sometimes you just need to reinstall and start over. Whether due to hardware failure or the general software “gunk” that builds up over time, I seem to find myself re-installing Windows on a fairly regular basis. As the deadline for my semi-annual Windows re-installation ritual draws near I’m considering a move from Windows XP to Windows Vista.
Flashy features aside, one of the things that interests me most about Vista is the ability to do an image-based installation of the OS. This is dramatically different than Windows XP where the setup process acts more like an “installer program” that creates directories and copies files. What you get on the Vista DVD is actually a pre-installed copy of Windows that simply gets decompressed onto your PC. The difference may not seem important until you consider the fact that you can actually alter the Vista image in any way you want — this means that you could create a custom image that includes your favorite applications and use that as the starting point for all future installations.
For someone like me that seems to do OS installs on a regular basis, this has the potential to make the process a lot less painful. The worst part of re-installing your system isn’t the OS itself, it’s all the other junk: MS Office, Adobe Reader, WinZip, Firefox, etc. I would love to have all of those applications available as soon as I boot my freshly installed system the first time — and that’s exactly what I’m going to show you how to do here.
The Goal
The goal for my little demonstration is to create a new Windows Vista image that has all of my must-have applications pre-installed and then apply that image to a new machine. For now I’m just going to leave my custom Vista image on my hard drive, but in part 2 of this guide, I’ll show how to create a bootable USB flash drive with the image on it.
The Tools
If you’re going to follow along at home, here are the tools that you’re going to need:
- Microsoft Windows Vista – Feel free to use whichever flavor of Vista suits your needs. These instructions assume that you’ll be working from an ISO image of the Vista installation disc, but you can also use a physical Vista DVD if you have that handy.
- Windows Automated Installation Kit (WAIK) – This is a set of utilities provided by Microsoft that, among other things, allow you to work with the Vista image files (WIM files) and create your own bootable disks. You can download the WAIK itself here and the documentation here.
- Microsoft Virtual PC 2007 – We’re going to need at least two PCs to build our image. Instead of using two physical machines, it’s much simpler to use VPC and create a virtual machine instead. By using Virtual PC, we’ll be able to create our Vista image and even do some test installs without impacting any of our actual PCs. Once we’re confident that everything is set-up the way we want, we’ll be able to apply the image to as many actual PCs as we want. Virtual PC is a free download and can be found here.
Before proceeding to the next section make sure that you have installed the WAIK and Virtual PC 2007. Since we’re going to be working with some fairly big files, I’d also suggest that you have at least 10GB of free disk space to play with.
Phase 1 – Create the Image
The first thing we need to do is to create a custom Windows Vista image that contains the applications that we’d like to have as part of our default installation. Using Virtual PC, we’ll create a new virtual machine, do a regular Vista install, and then install our applications.
- Start Virtual PC 2007 and click the “New…” button to launch the New Virtual Machine Wizard. When prompted, select the option to “Create a virtual machine”. Name your new virtual machine “Vista Install Image” and be sure to select “Windows Vista” as the operating system. You can leave the default RAM allocation, but be sure to select the option to create “a new virtual hard disk”. The default name, location and size for the virtual hard disk will be fine.
- Once you’ve created your new virtual machine, select it in the Virtual PC Console and click the “Start” button to boot the machine.
- As your virtual machine boots, you’ll likely see some BIOS messages flash briefly and then some cryptic info about MAC addresses and DHCP as the machine attempts to locate a network boot device. You’ve basically got a machine with no operating system at this point so there isn’t much it can do. Let’s actually give it something that it can boot from. Go up to the “CD” menu in your virtual machine window and select “Capture ISO Image…”. Select the Windows Vista ISO file and press the “Open” button. This is the virtual machine equivalent of putting a DVD in the drive.
- Now that we’ve actually got a bootable disk in the “drive”, go to the “Action” menu and select “Reset”. This time you should see the virtual machine boot into the Windows Vista setup program. From here, you simply need to go through the standard Vista setup process: answer questions, watch hard disk light flash, reboot, repeat. You can proceed with step 5 after Vista is completely installed and you’re logged-in.
- At this point, you should have a fresh install of Vista ready to receive whatever applications you want to install. This is probably a good time to run Windows Update and make sure that you have all of the latest system patches. Whatever apps you install at this point will become part of your master image. Everyone has what they consider their core set of applications, for me this is:
- MS Office 2007
- MS OneNote 2007
- Visual Studio 2008
- Pidgin
- Firefox
- Winzip
- Notepad++
- Xplorer2
- Adobe Acrobat
You don’t want to get too crazy here since we’d like to be able to copy our system image onto a USB flash drive (the one I have is 4GB) or a DVD (4.7 GB) — of course, if you’ve got a really big flash drive or a dual-layer DVD burner feel free to go wild.
It can be a bit tricky to determine just how big your image file is going to end up being, since it does compress the files and certain files like the virtual memory paging file (which is typically quite big) are omitted by default from the image. You may have to go through a couple of iterations of installing apps and capturing the image to get just the right size. I was able to get the apps listed above into a image file that was 3.44 GB.
Go on to step 6 after you’ve got all your updates and apps installed.
- Now that you have all your applications installed, the final step is to run the sysprep tool. The purpose of sysprep is to “generalize” the system settings before we capture the image. Sysprep will clear out the computer name, the driver cache the the security identifier (SID) for our Vista installation — these things are unique to each system so we need to ensure that they are cleared before we capture the image. Later, when we apply this image to a new machine and boot it for the first time, a unique SID will be generated, we’ll be prompted to enter a machine name, and the driver cache will be recreated based on the specific hardware of that machine. To run sysprep, you simply need to open a command prompt and issue the following command:
> c:\windows\system32\sysprep\sysprep.exe /quiet /oobe /generalize /shutdown
Sysprep will do its thing for awhile and then your virtual machine should automatically shutdown. Once this happens, you are ready to move on to phase 2.
Phase 2 – Create a WinPE Boot Disk
Now that we’ve got our Vista install looking just the way we want, we need to create an image of our virtual disk drive. We’ve got a bit of a problem though: we need access to the C: drive of the virtual machine, but we can’t boot into OS we have installed on that drive. If we were to start our virtual machine at this point and allow Vista to boot, it would undo all the work that sysprep just did for us. The trick is to boot the virtual machine from something other than the hard disk — we need a boot disk and this is where WinPE comes in handy.
Windows Preinstallation Environment (WinPE) is a stripped-down version of windows that will boot from a CD, DVD or USB Flash disk. You can think of it as the DOS boot disk on steroids. When you run WinPE you get a basic command line interface but you’re still running in the Windows environment so you can do things like access network resources and run Win32 applications. I’ll probably do a whole post on WinPE at some point, so I won’t go into all the details here. For now, we simply need to create a WinPE boot disk that will allow us to boot our virtual machine and capture the contents of the C: drive.
- Be sure that you’ve got the WAIK installed, then open a command prompt and type the following:
> cd C:\Program Files\Windows AIK\Tools\PETools\ > copype.cmd x86 C:\WinPE_x86
The copype command simply copies all of the WinPE files to the directory of your choice. The “x86″ flag indicates that we want the 32 bit version of the WinPE environment.
- The WinPE environment comes with lots of useful utilities by default, but there is one critical program called ImageX that we’re going to need in order to capture our disk image. We need to copy ImageX to our WinPE disk so that it is available when we boot into the WinPE environment. From the same command prompt you opened in the previous step, do the following:
> mkdir C:\WinPE_x86\iso\Tools > copy "C:\Program Files\Windows AIK\Tools\x86\imagex.exe" C:\WinPE_x86\iso\Tools
- In addition to the ImageX executable we also need to create an ImageX configuration file. Copy and paste the following into a text file named wimscript.ini and save it in the
C:\WinPE_x86\iso\Toolsdirectory.[ExclusionList] ntfs.log hiberfil.sys pagefile.sys "System Volume Information" RECYCLER Windows\CSC MSOCache [CompressionExclusionList] *.zip *.cab \WINDOWS\inf\*.pnf
The
[ExclusionList]section identifies all of the files/folders that will be omitted from the image when it is captured. The[CompressionExclusionList]section identifies those files that should not be compressed. Since ZIP and CAB files are already compressed, we can speed up the image capture process by preventing ImageX from attempting to compress them further. - The final step in this phase is take all of the WinPE files (including the ImageX files we added) and create an ISO disk image that we can use to boot our virtual machine. For this, we use the oscdimg tool that comes with the WAIK. From the command prompt, do the following:
> oscdimg -n -bC:\WinPE_x86\etfsboot.com C:\WinPE_x86\ISO C:\WinPE_x86\winpe_x86.iso
The “-n” flag indicates that we like to enable support for long file names and the “-b” flag specifies the path to the boot sector file that should be written to the disk image. The last two arguments identify the source location of the Windows PE files and the target ISO image file respectively.
If you navigate to the C:\WinPE_x86 directory now you should find that you have a file named winpe_x86.iso. This is the WinPE disk image that we’ll use to boot our virtual machine in the next phase.
Phase 3 – Capture the Image
The next step is to capture an image of our Vista install. We’ll boot our virtual machine using our freshly minted WinPE disk and use the ImageX tool to capture the contents of the virtual hard disk in a WIM file. Unlike the ISO image format which is sector-based, WIM is a hardware-independent, file-based format — that means that the smallest unit of information captured by the image is a file. Among the benefits of a file-based image format is the ability to use aggressive file compression.
- Be sure that you read all the instructions in this step before proceeding. We’re going to boot our “Vista Install Image” virtual machine again, but we need to ensure that we boot from our WinPE disk and not from the virtual hard disk. If we boot from the virtual hard disk and let Vista startup we’ll have to go back and do the sysprep step again. Bring up the Virtual PC Console, select your “Vista Install Image” and click “Start”. As quickly as you can, go to the “Action” menu in the virtual machine window and select “Pause”. This will pause the boot process and give us a chance to mount our WinPE disk. Now go to the “CD” menu and select “Capture ISO Image…”. Select the WinPE image we created in the previous phase at
C:\WinPE_x86\winpe_x86.isoand press “Open”. Go back to the “Action” menu and select “Resume” to allow the boot process to continue. Watch for the message that says “Press any key to boot from CD or DVD” and be sure that you “press any key”. - It’ll probably take a minute or two for WinPE to boot, but when it’s done you should see command prompt window. Note that the current directory for your command prompt is
X:\windows\system32. The X: drive is a RAM disk that was created by the WinPE bootstrapper and loaded with the WinPE runtime. If you cd around the X: drive you’ll find that it looks a lot like a normal Windows installation with directories like “Windows” and “Program Files”.From the WinPE environment, you should find that you have access to two other drives: the C: drive which is the where our Vista installation is located and the D: drive which is the virtual CD drive containing our WinPE boot disk. We’ll be using each of these drives shortly so you might want to make sure that you can access them from the command prompt.In the next step we’re going to create our system image, but first we need to figure out where we’re going to put the image we create. The WIM file will likely be many gigabytes in size so we need to pick a location that has plenty of space. We can’t use the virtual C: drive cause that’s the disk we’re going to image. We can’t use the D: drive cause it is read-only. We can’t use the X: drive cause it’s just a RAM disk and disappears as soon as the machine shuts down. What we need is to make a connection from the virtual machine back to the physical machine and store the WIM file there.
To make a connection back to the physical machine, we’ll use the net command to map a new drive. From the command prompt, issue the following command:
> net use z: \\<insert machine name here>\c$
Obviously, you’ll need to replace the <insert machine name> string with the actual host name of your physical machine. Depending on how things are configured, you may get prompted to enter some credentials — you can simply enter the username and password that you use to log onto your physical machine (assuming, of course, that you are an administrator on that machine). Once this is complete, the Z: drive in your virtual machine will map directly to the C: drive on your physical machine and provide a convenient mechanism for copying files between the two.
- Now that we have a place to copy our image to we can get down to actually capturing it. Switch over to the D: drive and cd into the
D:\Toolsdirectory (remember this is where we placed our copy of ImageX and the corresponding configuration file). Once you get to the Tools directory, issue the following command:> imagex /capture c: z:\myvista.wim myvistaimage
This will cause ImageX to capture the contents of the C: drive (remember this is the C: drive of the virtual machine) and copy them to a file named “myvista.wim” on the Z: drive (which really maps to the C: drive of the physical machine). The final argument is simply a name that gets associated with the image we’re creating (feel free to use anything you like). It’s actually possible to store multiple system images in a single WIM file and each one needs a unique name. If you think you might create multiple images, it’s probably best to use names that are somewhat descriptive.
- ImageX is going to do its thing for awhile so you might want to go grab a sandwich or something (for me, this part seems to take between 20 and 30 minutes depending on how many applications I have installed). When it’s done you can shutdown the virtual machine by going to the “Action” menu and selecting “Close”.
Congratulations, you should now have your customized Vista WIM file! If you go to the root of the C: drive on your physical machine you should find your myvista.wim file. Take a look at the file size of your WIM. If this file is bigger than the media that you ultimately want to copy it to, you’re going to need to go back, uninstall some apps and repeat the image capture process (note that you don’t need to repeat the steps in phase 2 — your WinPE disk is good for multiple boots).
If you find that you’re having trouble getting the WIM file down to a reasonable size, you can ask ImageX to use a more aggressive compression routine by substituting the following command in step 3 above
> imagex /compress maximum /capture c: z:\myvista.wim myvistaimage
Note that this will make the image capture take a lot longer (over an hour in my tests). It will also make application of the image to future systems take more time
Phase 4 – Testing the Image
Now that we have our image, let’s try and apply it to a new machine to make sure everything works properly. We’ll use Virtual PC 2007 again to create a new virtual system and then apply our image to that system.
- Go back to the instructions for phase 1, step 1 and create a new virtual machine — do everything the same except you’ll want to select a different name this time (maybe “Vista Test”).
- Go back to the instruction for phase 3, step 1 and boot your new test machine from the same WinPE boot disk we created in phase 2.
- Before we can apply our Vista image to the new system, we first need to partition and format the virtual hard disk. WinPE comes with a utility called DiskPart that will help us here. For those of you that have been working with DOS/Windows for awhile, DiskPart is the modern equivalent of the old fdisk utility. You can start DiskPart from the command line by simply typing “diskpart” which will drop you into the DiskPart shell (recognizable by the
DISKPART>command prompt). Once in the DiskPart shell, issue the following commands:DISKPART> select disk 0 DISKPART> create partition primary DISKPART> active DISKPART> select partition 1 DISKPART> format fs=ntfs quick DISKPART> assign letter=c DISKPART> exit
I won’t go into all the details of DiskPart here (again this could be an entire post unto itself), but in short what we did was select the virtual hard disk, partition it, mark the new partition as active, formatted the partition with NTFS and assigned it the drive letter C:. Now our virtual disk is ready to accept our Vista image.
- We’re going to need access to our WIM file so go back to the instructions for phase 3, step 2 and map the Z: drive of your virtual machine to the C: drive of your physical machine.
- We use ImageX utility to apply the image so switch to the D: drive and cd into the
D:\Toolsdirectory just like we did in phase 3, step 3. Once you’ve done that, issue the following command:> imagex /apply z:\myvista.wim 1 c:
The first argument after the /apply flag is the path to the WIM file containing the image we want to apply. The second argument is the number of the image within the WIM that we want (alternatively, you can also use the image name we specified during the capture step, but since we only have one image in our WIM this is just easier). It should be fairly obvious that the final object represents the drive we’d like the image applied to.
Again, ImageX is going to crank away for awhile as it decompresses our image and copies files to our virtual drive. This step should go a little bit faster than the capture process.
- When ImageX finishes, we’re ready to reboot and test out our new Vista install. Go to the “Action” menu and select “Reset”. This time we don’t want to boot from the WinPE disk so just let the boot process proceed normally. This initial boot will likely take a little longer then normal, but ultimately we should see the Vista OOBE (or “Out-of-box- Experience”) wizard. The OOBE wizard is a set of dialogs that prompt you to select your country/language, create user accounts, select a computer name, etc (the responses to all of these prompts can be automated, but I’ll save that for another post). At some point you should end up at the Vista login screen. From here, all that’s left to do is to login and check to see that all the apps/updates you installed are there.
Woo hoo! It was a lot of work, but hopefully it saves you some frustration in the long run.

7 Responses to “Custom Windows Vista Installation”
Wow, amazing post. I am definitely sure will be visiting this site again and again for more updates and new things.
Excellent posting, thanks for sharing.
Hi there, after searching for hours on end on how to achieve this I came across your site with detailed step by step instructions.
After a couple of hick-ups due to my main drive acctually being d: instead of c: on my main machine, Editing some of your code in the steps seamed to be the obvious choice and it worked.
Now that I have completed the steps I am very interested in how to create a bootable version of the image i created so that I can use it for my machine and laptop.
The quicker the better please as I am dying to try this to see what the out come is on my laptop.
Thanks for the walkthrough it took about 9 hours in total due to some issues. (d:)
As everyone else said, thank you so much! I’ve been looking for this for a while now, because vLite doesn’t have a way to preinstall applications. This is amazing. I too would like to know, how from here we make a bootable disc. I tried renaming the wim file to install.wim and replacing the one on the original vista image, but that did not work. Any suggestions?
Again, thanks a ton!
@Erik I keep meaning to come back to this topic and see what it takes to create your own bootable disc, but just haven’t had the time. I will say that I’ve had good luck simply creating a bootable WinPE drive (on a USB flash drive) and then using “imagex /apply” to do my installation. It’s maybe not as elegant as the standard install process, but it certainly gets the job done.
Hi this is great post i have been searching for a very long time on the net for software that would create a custom boot disk and i am glad to find this post i have one problem tho when i am trying to connect to my physical machine from the winpe2 command prompt net use z: \\\c$ it comes up with system error 53 the network path was not found. obviously i have entered the name of my physical computer were it says insert machine name here.
the drive on my physical machine is names as c: and the winpe is named as x: can someone please tell me what i am doing wrong if i am.
Please reply at
simon.leavesley@gmail.com
Thanks
Simon
check this link:
worked for me
http://social.technet.microsoft.com/forums/en-US/itprovistadeployment/thread/b9bde7f6-6109-4028-82b7-764eb4793f02/
Leave a Reply