For those of us working on a budget, we don’t have MS OpCenter or the alike. With this in mind, some of us still deploy images the old fashioned way using a WIM and USB stick. Those images get out of date pretty fast and keeping them up to date can be a nightmare but here I will show you how to combat that quickly and for free.
We’ll use c:\temp, c:\temp\mount and C:\temp\updates for the rest of the documentation so please create these now.
Grab your base image (install.wim or what ever you have called it) and drop it on to your local PC in c:\temp.
Grab a copy of http://www.windowsupdatesdownloader.com/Default.aspx to grab your updates.
Launch WindowsUpdatesDownloader and click the plus, this will take you to the website to grab a list file of all the updates. Select the ones you wish to download as you need them. I grab them all by default to make my life easier. Make sure the download directory is set to c:\temp\drivers
Grab a sandwich, cup of coffee and fire up Reddit while WUD grabs a gazallion updates from MS….
Being nice, WUD organised all the files in to categories. This is actually inconvenient as we are doing this by hand. Drag all the files back to c:\temp\updates. I will give a script at the bottom so we can automate the whole thing but for now let’s just learn the slightly harder way…
It’s time to do some magic using DISM (built in to 8.1, download the WAIK for Win 7 from MS and install if required). Open an Elevated CMD prompt:
Mount your WIM file that you want to patch:
dism /mount-wim /WimFile:C:\temp\install.wim /index:1 /MountDir:C:\temp\mount
Push dem updates baby!:
dism /image:C:\Temp\Mount /Add-Package /Packagepath:C:\temp\updates\
That coffee you had? Go make another…
Once the updates have completed, unmount and commit your changes:
dism /Unmount-Wim /Mountdir:C:\Temp\Mount /commit
Tidy up any left over bits:
Copy your WIM file back to your build stick and voila (not viola, that’s a musical instrument that takes more skill than IT). Now next time you use the image you won’t have half as many updates.
For the lazy and totally initiated, here’s the PowerShell script so you don’t have to do much and you can run this straight after WUD without having to reorganise your files:
$UpdatesPath = "C:\temp\updates\*"
$MountPath = “C:\temp\mount”
$WimFile = “C:\temp\mount\install.wim”
Write-Host "Mounting the WIMp file..."
DISM \Mount-Wim /WimFile:$WimFile /index:1 /Mountdir:$MountPath
$UpdateArray = Get-ChildItem –Path $UpdatesPath -Include *.msu *.cab
Write-Host "Grabbing updates and installing..."
ForEach ($Updates in $UpdateArray)
DISM /image:$MountPath /Add-Package /Packagepath:$Updates
Start-Sleep –s 5
Write-Host "Committing changes"
DISM /Unmount-Wim /Mountdir:$MountPath /commit
Write-Host "All done."
Have a good day now!