- 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.
Read the latest IT news and community updates!
Join our IT community and read articles without ads!
Do you want to write for 4sysops? We are looking for new authors.
Well now this is strange!
In the entire C:\Windows\SoftwareDistribution hierarchy on a fully patched Win8.1 machine, I have only one—one—KB update:
windows8.1-kb2976978-v10-x64-express.cab
What’s to be made of it?
Thanks,
Jeff Bowman
Fairbanks, Alaska
Any chance your machine had updates slipstreamed into before hand (or you ran the resetbase command in powerhsell)?
> Any chance your machine had …
Not a chance. Big mystery, that.
Guess I’ll just have to find another way to get ’em. Great article!
Thanks,
Jeff Bowman
Fairbanks, Alaska
Thank you Jeff!
It turns out there’s a way to do it in PowerShell:
https://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc
I found the link here:
http://finalthought.org/creating-customized-windows-8-1-media-iso-wim-flash-drive/
Thanks,
Jeff Bowman
Fairbanks, Alaska
Thank you for posting back this solution Jeff!
You’re welcome 🙂
Joe Wright’s post doesn’t replace yours here—they’re just two different ways of tackling the same sticky problem.
Thanks,
Jeff Bowman
Fairbanks, Alaska
I inject the packages PRE starting the machine.
First download the monthly ISO packages from https://support.microsoft.com/en-au/kb/913086.
Then mount the ISO and mount the VHD/X.
Then run something like, where h: is the ISO drive and g: is the VHDX.
dir h: -Recurse -Include *.msu,*.cab | ForEach-Object {Add-WindowsPackage -PackagePath
$_.FullName -Path g: -LogPath .\packages.log -LogLevel 2}
Thank you for your solution Andrew!
Joseph, what exactly does the %U% or %F% reference after the /packagepath? Thanks.
It is a foreach loop.
I should probably re-write this in PowerShell completely.
I’m trying this, but it give an error when running the command
Start /w for /R \\DEPLOYMENY-64\C$\Windows\SoftwareDistribution\Download\ %f in (*.cab) do DISM /image:C:\Mount /add-package /packagepath:
tried the /packagepath:%f and %u and with and without “”
keep getting the errors:
————————————————————————-
C:\Windows\System32>DISM /image:C:\Mount /add-package /packagepath:”%U”
Deployment Image Servicing and Management tool
Version: 6.3.9600.17031
Image Version: 6.1.7601.18489
An error occurred trying to open – “%U” Error: 0x80070003
Error: 3
The system cannot find the path specified.
The DISM log file can be found at C:\Windows\Logs\DISM\dism.log
—————————————————————————–
C:\Windows\System32>DISM /image:C:\Mount /add-package /packagepath:\\DEPLOYMENY-
64\C$\Windows\SoftwareDistribution\Download\1a72828373c82bbf5de3f9525ce6dce8\ie1
1-windows6.1-kb3093983-x64-express.cab
Deployment Image Servicing and Management tool
Version: 6.3.9600.17031
Image Version: 6.1.7601.18489
Processing 1 of 1 – Adding package Package_for_KB3093983~31bf3856ad364e35~amd64~
~11.2.1.0
[===========================66.1%====== ]
An error occurred – Package_for_KB3093983 Error: 0x800f0816
Error: 0x800f0816
DISM failed. No operation was performed.
For more information, review the log file.
The DISM log file can be found at C:\Windows\Logs\DISM\dism.log
“”
VersionComp: EQ, ServiceComp: EQ, BuildComp: EQ, DistributionComp: GE, RevisionComp: GE, Exist: present
2015-10-16 09:55:43, Info CBS Appl: detectParent: package: Package_31_for_KB3037574~31bf3856ad364e35~amd64~~6.1.1.0, no parent found, go absent
2015-10-16 09:55:43, Info CBS Appl: detect Parent, Package: Package_31_for_KB3037574~31bf3856ad364e35~amd64~~6.1.1.0, Parent: WinEmb-NetFx20~31bf3856ad364e35~amd64~hr-HR~6.1.7601.17514, Disposition = Detect, VersionComp: EQ, ServiceComp: EQ, BuildComp: EQ, DistributionComp: GE, RevisionComp: GE, Exist: present
2015-10-16 09:55:43, Info CBS Appl: detectParent: package: Package_31_for_KB3037574~31bf3856ad364e35~amd64~~6.1.1.0, no parent found, go absent
2015-10-16 09:55:43, Info CBS Appl: detect Parent, Package: Package_31_for_KB3037574~31bf3856ad364e35~amd64~~6.1.1.0, Parent: WinEmb-NetFx20~31bf3856ad364e35~amd64~lt-LT~6.1.7601.17514, Disposition = Detect, VersionComp: EQ, ServiceComp: EQ, BuildComp: EQ, DistributionComp: GE, RevisionComp: GE, Exist: present
“”
I can’t find any help threads for this issue?
I tried the command as it was displayed and had the same problem as A Kofoed. This worked for me.
1. mounted the image to C:\Mount
2. Opened elevated command prompt
3. Start /w for /R C:\Windows\SoftwareDistribution\Download\ %F in (*.cab) do DISM /image:C:\Mount /add-package /packagepath:”%F”
I think he had “%U” which did not seem to work. Maybe a typo?
SCott: its not a typo, since i tried both %F and %U with and without “” (se my post again)
I now tried this on the Updated PC and it does the same error, this is fustrating
Hey i think you are too much complexed with this for loop.You could easily write this like this (Start /w for /R “%windir%\SoftwareDistribution\Download\” %f in (*.cab) do DISM /image:C:\Mount /add-package /packagepath:%f).But it looks like in DISM quotes make error in both first one and for loop too so i tried every one of them without quotes and it works.
Re: Express updates. In an SCCM environment you can get around this by using the appropriate update package as a source for the CABs. If you’re using WSUS, you can use the WSUS content subfolder. However, you’ll also pick up a load of Office updates in all likelihood which won’t install by this method. Alternatively, set up a subordinate WSUS server, configure it only to sync OS updates with your main server, approve the required updates on this server then use its content subfolder once it’s finished downloading.
Incidentally, I also find that sometimes DISM hangs after installing an update with the last line in the logfile being ‘Releasing the local reference to DISMLogger. Stop logging. – CDISMProviderStore::Internal_DisconnectProvider’ – you have to kill the DISM process for it to go on to the next update. If you don’t, DISM uses all the available CPU for a while and gradually increases in memory use. Sometimes it falls out the end, sometimes not.
I am following your guide, and I can’t get it working, maybe I am doing something wrong. I get the message: An error occured tring to open – % Error: 0x80070003. Doesn’t matter if I tried -%f or “%f” or “%u” — no idea what I am doing.
Here is the step I took:
1) copy os image to c:\
2) mounted image (had to figure out what all these paths were, was getting error: 123)
3) used your “The easier way to slipstream Windows updates” (had to find out how to get pc name)
4) I get the message An error occured tring to open – % Error: 0x80070003
After some googling, someone asked the question if they are using WinPE or Windows. I am doing this via Windows OS (active). Was I supposed to uses some software like WinPE? Didn’t see it mention here. A dummy step by step guide would be appreciated.
I’m not sure exactly why you are getting that error but you don’t need to be in Windows PE for this script to run.
I am not sure if it is relevant, but this error appears to be an association of being used by windows system; at least that’s what google says.
googling says its being used by system OS as the reason why this error.
Hi i just used this command to update a windows 7 ultimate wim.
I removed the “%U” at the end of the linde and replaced it with just a %f
With no quotation marks and it worked fine.
My guess is if you don’t have a space in the path to your windows updates folder, then it should work with the %f variable instead of the “%U”
ok i give up on this method, all i get is more errors using %f
I’ve noticed that if you view the dism.log file in, for example, Trace32.exe (SCCM Log File Viewer, very useful for monitoring logs in real time) sooner or later an update will hang on finishing and the memory usage of dism.exe will go up and up until it crashes with a memory exception.
Leave it and don’t view the log file, and its fine. Even viewing the log file from another computer causes this behaviour