- SmartDeploy: Rethinking software deployment to remote workers in times of a pandemic - Thu, Jul 30 2020
- Outlook attachments now blocked in Office 365 - Tue, Nov 19 2019
- PolicyPak MDM Edition: Group Policy and more for BYOD - Tue, Oct 29 2019
Update: If you are looking for a way to download updates read this and this new article explains how to slipstream updates with PowerShell and SCCM.
If you have ever watched a fresh OS install download update after update, you understand how frustrating and time consuming it can be. There are several solutions that will ensure a new machine is completely patched before the end user even gets the machine. For example, MDT includes two separate tasks for updating a machine during a task sequence.
The Windows Update Task in an MDT Task Sequence can slow down imaging.
Another common method is to load Windows Update packages into the MDT Deployment Workbench Packages container.
The downside to most methods is the increase in imaging times. When you are installing 150+ updates on a Windows 7 machine, things can slow down to a crawl.
One great alternative is to use DISM and the /add-package parameter. With DISM and a simple batch file, we can loop through Windows Update packages and apply them to our .WIM files. Let’s briefly cover DISM and prep our environment before jumping into the cooler stuff.
Using DISM to install Windows Update packages
Start by creating a folder in the root of C:\. Name the folder Mount. Next, launch an administrative command prompt (WIN + X, A for Windows 8+ machines) and execute DISM to see the list of available options and the proper syntax. If you have ADK installed, you can launch the Deployment and Imaging Tools Environment shortcut as an administrator. This is my preferred method.
Getting help with DISM is made easier with command prompt examples.
Your first step is to mount your OS install.wim file. If you are using MDT, this file is located in your DeploymentShare under Operating Systems\OS Name\sources\. At your administrative command prompt, type the following:
dism /mount-wim /wimfile:”D:\DeploymentShare\Operating System\Windows 7 SP1\Sources\install.wim” /mountdir:C:\Mount /index:1
When the WIM is mounted, you should be able to browse to C:\Mount and view the contents.
A mounted WIM within Windows Explorer. An OS within an OS.
To add a Windows update, type the following command:
dism /image:C:\Mount /add-package /packagepath:PATH-TO-UPDATE
Adding updates with the above command is almost as tedious as watching 150 of them install. In the past, I would head to the Windows Update catalog and download every update that was needed. Although I will still do this for some single updates, I use a faster method now.
The easier way to slipstream Windows updates
To use this method, you will need to set up a fresh machine and let it fully update. This has to be done for each OS that you deploy. Luckily, you will only have to do this one time. When your first machine is fully patched, head back to your administrative command prompt and type the following:
Start /w for /R \\UPDATEDMACHINE\C$\Windows\SoftwareDistribution\Download\ %f in (*.cab) do DISM /image:C:\Mount /add-package /packagepath:”%U”
Be sure to specify your machine’s name in the command. This will launch a new window where you can watch as each update is installed. Even though this part is automated, it will still take a while to complete (about an hour for my test VM).
DISM has successfully added Windows updates to our WIM.
Once you are at the return prompt in the second window, all available updates have been slipstreamed. Head back to your first command prompt and type:
Dism /unmount-wim /mountdir:C:\Mount /commit
At this point, DISM will apply the changes that you’ve made, save your image, and unmount it. Your local Mount folder should now be empty. To speed up this process on other operating systems, save the following commands in a batch file:
dism /mount-wim /wimfile:”D:\DeploymentShare\Operating System\Windows 7 SP1\Sources\install.wim” /mountdir:C:\Mount /index:1 Start /w for /R \\UPDATEDMACHINE\C$\Windows\SoftwareDistribution\Download\ %f in (*.cab) do DISM /image:C:\Mount /add-package /packagepath:”%U” Dism /unmount-wim /mountdir:C:\Mount /commit
Deploy your fully patched image to a test computer. Once the install finishes, check Windows Updates for any available updates. You should notice a drastic reduction! In my case, only updates that install with an EXE were still available. From here, you can deploy those remaining updates with WSUS or MDT Applications, or you can allow the Windows Updates task to finish the job.
Update: If you are looking for a way to download updates read this and this new article explains how to slipstream updates with PowerShell and SCCM.
I’m only done this for Professional and Enterprise as those are the only two editions supported in a domain.
JF Martel: That’s awesome! That step can take a bit of time!
Why would anyone try to slipstream updates into 7 when there is already up to date 8.1.3 exist ? I am trying to slipstream updates into 8.1.3.
I don’t really understand your question Recep – can you rephrase it?
Perfect article but I don’t understand people who insist on Windows 7. Windows 8.1.3 has all the updates included. So, instead of tying to slipstream hundreds of updates into W7, people should just try 8.1 Update 3. You need just 50 updates to slipstream.
Thanks Recep! I agree on that – some organizations may not have access to 8.1 (due to funds, tech, etc).
There’s also a lot of additional support overhead that goes into moving to Windows 8.1 in an organization. Many functional, non-technical, employees are going to require training on how to use the new Windows 8.1 interface. There are also a lot of OS changes that are going to require updates to things like systems management, corporate applications, and a lot of other things I can’t mention in a blog comment. In large organizations, it isn’t as simple as just installing the newest thing.
Very true Kyle.
Hi Joseph. My co-worker and I are revisiting this process. It kind of fell off the radar due to other “more important” projects. Pfftt! 🙂 Anyway, after dissecting the commands and your article plus everyone’s comments, it looks like it’s working for us. The only 1 thing that seemed odd was the progress indicator stopping at 65% on some of the updates; others did run to 100%. We attributed that to dism seeing that update was already installed. As always, your input and everyone’s are welcome. Thanks.
I would say those updates aren’t applicable to be installed. Glad that everything else worked for you though!
Joseph, this is a great article. I’ve seen programs that automate the slipstreaming parts by using dism for you. I ran into a problem after slipstreaming the updates and thought maybe you could help me figure out what to do. After I slipstream, I try installing windows 7 x64 bit. The original install.wim is from a SP1 retail (or OEM) disc. The error message I get is “Windows could not configure one or more system components. To install windows, restart the computer and then restart the installation”. Every time the PC restarts, it gives me the same error message. I cannot install 7. I started looking around in the C:\Windows\System32\Panther directory and after looking through some log files, it seems the problem is caused by the updates requiring .NET Framework 4.5 but .NET Framework 4.5 not being on the disc. There seems to be about 45 messages saying .NET Framework 4.5 isn’t found. I cannot figure out how to tell which updates require .NET Framework 4.5 though. Is there an easy way to figure this out? Or is there a way to slipstream .NET Framework 4.5 onto the installation disc so the updates get installed? Thanks for the help!
Thank you Spork – check out the revised script here: https://4sysops.com/archives/use-the-dism-powershell-cmdlets-or-sccm-to-slipstream-updates/
Let me know if it fixes your problem.
Thank you for the quick reply Joseph. I’ve never used Windows PowerShell before and I’m having some troubles following the tutorial you linked me to. I start up Windows PowerShell ISE (not the x86 version). I try running the Mount-WindowsImage command but every time, I get a command not found error message. I also tried it in just normal PowerShell (not the ISE version) and ran across the same problem. The system I’m running PowerShell ISE on is a Windows 7 x64 Home Premium. I even tried installing the Windows Assessment and Deployment Kit. It said it included the DISM module for Windows 7, among some other versions of Windows. I believe the commands in the link you provided would work in PowerShell ISE for Windows 8. I just don’t have any Window 8 systems. Any suggestions? Thanks for the help!
I also should of mentioned that before I was running a much older version of PowerShell. I just upgraded to version 4. For some reason, I thought Windows Update installed PowerShell version 4. Even with version 4, I still cannot get the Mount-WindowsImage command to run. Here’s the version:
PS C:\Windows\system32> $PSVersionTable.PSVersion
Major Minor Build Revision
—– —– —– ——–
4 0 -1 -1
Here’s the error message I get:
Mount-WindowsImage
Mount-WindowsImage : The term ‘Mount-WindowsImage’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Mount-WindowsImage
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Mount-WindowsImage:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I finally figured it out! I had to run:
set-executionpolicy unrestricted
Import-Module “c:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\AMD64\DISM”
After that, the Mount-WindowsImage command shows up as valid! I’ll let you know if the updates work or not once I finish integrating them.
Awesome!!
I love it.
I have used the windows update download manager to download all the patches to c:\temp\updates and then modified the script to :
start /w for /R c:\temp\updates %f in (*.msu) do DISM /image:c:\mount /add-package /package-path:”%f”
works like a charm, it is applying all the updates at the moment.
thanks all !!
“Windows Update Download Manager”? What the What?
Can you please share how you cobbled the download portion together? Thanks.
I would like to just download the latest x64 updates and nothing else.
windows update download manager – I did not know it either, but someone else mentionned it in the forum and it works good
http://www.windowsupdatesdownloader.com/
Oops one typo in the commandline
start /w for /R c:\temp\updates %f in (*.msu) do DISM /image:c:\mount /add-package /packagepath:”%f”
no “-” (minus) in the /packagepath
so in full:
copy all files from the “old” windows 7 CD to c:\win7
then you could use a batchfile which will mount the install.wim, then applies the patches and then saves/commits the updates:
dism /mount-wim /wimfile:”C:\win7\Sources\install.wim” /mountdir:C:\Mount /index:1
start /w for /R c:\temp\updates %f in (*.msu) do DISM /image:c:\mount /add-package /packagepath:”%f”
Dism /unmount-wim /mountdir:C:\Mount /commit
now you have updated the files to windows 7 SP1 and all later updates.
next step is to create a new ISO
and last step is to use microsofts utility to burn an ISO to a USB stick
https://www.microsoft.com/en-us/download/windows-usb-dvd-download-tool
last comment: I did the above for 64 bit windows 7.
it seems windows 7 32 bit is slightly different. the service pack was an executable (downloaded by the Windows Updates Downloader) so I used the following page to first “manually” apply SP1
http://superuser.com/questions/249275/slipstream-windows-7-service-pack-1
Oh that website. Heh! 🙂 Yes, used it too but came up short on updates plus I need Office updates as well. Cool utility nonetheless. I pointed DISM to our WSUS server and it took 12+ hours to update the image. I have to figure out how to filter for just the Windows 7 x64 architecture. Our server has updates for Server 2008, Server 2012, XP, Office, etc.
Hi,
Thanks for all the info. Whilst I can mount the image and run the command successfully, so far it has been running for nearly 9 hours and has still not completed. My machine has been unusable during this time so I have been using another one. I have had a couple of errors with DISM crashing and I briefly get to see the command prompt window, but it appears to have only parsed 2 of the 70 updates so far and seeing as it crashed I’m not sure it has even applied them.
Have you ever experienced this? Originally I had tried downloading them from the WSUS Catalog and injecting them individually but that was giving me error code 0x8007002.
Appreciate any help you can give.
Thanks
Tom
I have not seen that before Tom – you may want to try this on a clean VM.
Hi, thanks for the heads up. I still have an AIO USB drive with Windows 7 where i install all my PC’s from my friends and family. Patchlevel is December 2013.. so its pretty darn old..
I download all updates wie WSUS Offline Updater at my home server (Debian Lenny) and share it with Samba to the network. So, if i have to reinstall a PC, install the Edition and Patch it first offline with local patches.
Now i thought, how could i bring them into my default installation media (USB Drive)? Your howto popped up, i give it a try, but i had one major problem: the install.wim is now nearly 9 GB 🙁
I have all 5 editions on that stick with 32 and 64 Bit. With the patches to 12/2013 it was 6,4 GB. Thats a real bummer. Do i really need to apply the patches to all 5 Windows Editions ?
Another thought was, setting up an WinPE Install Environment on my PXE, so i can install the whole thing over network 🙂
See the reset base parameter in this link. It should help you: https://technet.microsoft.com/en-us/library/hh825265.aspx