I often get asked by friends to re-install their computers and in return, they often offer dinner and wine in return… Sweet deal I think. Installing Windows doesn’t take very long but the patching-reboot-patching-reboot take hours and I prefer sitting at the dinner table than in front of the computer. At work, I can just leave the computer running and we also have MDT/WSUS to speed up things so I can create a full patched reference image, but not possible here. So I asked myself:
There has to be a way to create a thin, almost fully patched, Windows reference image with not a lot of effort and without infrastructure such as VMs/MDT/WSUS… How?
This is how I do it just using my laptop… It doesn’t include all patches but many and the reason for this is that some patches simply can’t be applied offline and some of them are dependent on other patches.
Before you start, make sure you have plenty of diskspace to hold all the ISOs, patches and temporary space for creating your image files. A comment on this post mentioned close to 20 GB free.
Get the patches
First, we need to get all the patches for the OS you’re installing. One way is to use WSUS and get the patches from the WSUSContent folder. But we don’t have WSUS. Another way is to install a client, run Windows Update manually and start writing down all patches that will be installed and manually download them from Microsoft Update Catalog. But for Windows 7 x64 that would be some 100+ patches and doing it manually would take too much time.
Select the OS you’re installing, in my case Windows 7 x64 Global and click Start. It will now download all patches locally, in my case C:\wsusoffline\client\w61-x64\glb (1.9 GB, 131 files).
Done! Now you have all the patches for the OS you’re installing.
Patch that image
Get the Windows ISO/DVD. Copy .\sources\install.wim to C:\Extract\sources\install.wim. Mount the file using the following command. If you don’t have dism already, you can get it from the Windows AIK download.
dism /mount-wim /wimfile:C:\Extract\sources\install.wim /mountdir:C:\dismmount /index:3
Run the following to add all patches from the above WSUS Offline Update to the image:
IMPORTAMT: If you’re offline patching Windows 7, make sure to remove KB2506143 and KB2533552 from the patch directory first since this update breaks the installation. A comment on this blog also says to remove KB2819745.
dism /image:C:\dismmount /Add-Package /PackagePath:C:\wsusoffline\client\w61-x64\glb
You will get some errors for certain patches and this is normal. Some patches simply can’t be added in offline mode so they have to be installed manually afterwards, but in my case, 118 out of 128 could be added which saves me a lot of time anyway. Example of an error message:
If you got the following, you didn’t read my instructions above carefully since this and another patch can’t be added offline:
Package Package_for_KB2533552 may have failed due pending updates to servicing components in the image. Try the command again.The specified package is not applicable to this image.
Once done, you need to commmit the changes:
dism /unmount-wim /mountdir:C:\dismmount /commit
Prepare the installation media
Now, just replace install.wim on the media you’re installing from. I prefer making a bootable USB stick using this guide. Get a fast one, like the Kingston DataTraveler R3.0 and you’ll save even more time.
Once installed you’ll notice you have a lot fewer patches to install. Now go ahead and enjoy more time with your friends instead of sitting in front of the screen watching Windows Update…
Some other stuff…
Here are some other useful dism command lines:
If you made an error, you can simply discard your changes:
dism /unmount-wim /mountdir:C:\dismmount /discard
You can get which packages and features installed on the image:
dism /image:C:\dismmount /Get-Packages
dism /image:C:\dismmount /Get-Features
Why index 3? Well, you can get the different indexes by running the following command:
dism /get-wiminfo /wimfile:C:\Extract\sources\install.wim
Please comment on how you quickly reinstall your friend’s computers so you can spend more time at the dinner table with them rather than in front of the computer.