How to use DISM to install a hotfix from within Windows
Hello, my name is Emmers Presson. I am a Support Escalation Engineer for Microsoft in the Windows Core team.
The purpose of this blog is to give you the steps to install a hotfix (or any other “package”) on the currently running operating system using the Deployment Image Servicing and Management (DISM) command. DISM is a new command-line tool that comes built-in for Windows 7 and Windows Server 2008 is the DISM tool. DISM combines the functions of multiple tools from the Windows Automated Installation Kit (WAIK) and allows users to perform multiple actions on operating system images. For the most part, this involves viewing and manipulating “offline images” which are in the Windows Imaging (WIM) file format. Here is a good reference that explains the function of the DISM tool and what the DISM tool is meant to replace:
There are also some DISM commands that target the running operating system (“online”). For example, you can use the following command to list the “packages” installed:
dism /online /get-packages /format:table
The command-line switch to install a package is “/Add-Package.” Let’s say that you are running Windows Server 2008 R2 Enterprise and you want to install the hotfix KB976571. When you download the hotfix file, the file name is “Windows6.1-KB976571-v2-x64.msu.” When you look at the DISM syntax in online help, you would assume that following syntax would work:
DISM.exe /Online /Add-Package /PackagePath:c:\kb976571\Windows6.1-KB976571-v2-x64.msu
where the .MSU file is stored in the c:\kb976571 folder.
Here is the screenshot of the results:
You will see the following snippet if you review the file c:\windows\logs\dism\dism.log:
2010-09-02 20:33:58, Info DISM DISM Package Manager: PID=7116 Encountered the option "packagepath" with value "c:\kb976571\Windows6.1-KB976571-v2-x64.msu" - CPackageManagerCLIHandler::Private_GetPackagesFromCommandLine
2010-09-02 20:33:58, Error DISM DISM Package Manager: PID=7116 DISM does not support installing MSU files online. - CMsuPackage::Install(hr:0x80070032)
Based on these results, you may wonder if you can really install packages online and if so, what type of file must you use if you can’t use MSU files? The answer is found in defining what a Microsoft Update Standalone Package (MSU) file is and how you would do this in the previous command-line tool, Package Manager (Pkgmgr.exe).
You had to extract the contents of a MSU file and instead use the .CAB file of the package in order to install or uninstall using the Package Manager tool (https://support.microsoft.com/default.aspx?scid=kb;EN-US;940410).
So try this approach:
1. Create a c:\temp\976571 folder.
2. Use the following command to extract the contents of the MSU file:
Expand –F:* c:\kb976571\Windows6.1-KB976571-v2-x64.msu c:\temp\976571
This resulted in extracting multiple files, which included the Windows6.1-KB976571-v2-x64.cab file.
Now try the following command:
DISM.exe /Online /Add-Package /PackagePath:c:\temp\976571\Windows6.1-KB976571-v2-x64.cab
This time I see the following:
Success!
You could tweak the command. For example, use the following syntax to install the package silently and avoid restarting Windows:
start /wait DISM.exe /Online /Add-Package /PackagePath:c:\temp\976571\Windows6.1-KB976571-v2-x64.cab /Quiet /NoRestart
You could use a similar command to uninstall an update using DISM. Here’s the syntax for that:
DISM.exe /Online /Remove-Package /PackagePath:c:\temp\976571\Windows6.1-KB976571-v2-x64.cab
I hope you find this helpful and explore other options for the DISM command-line tool.
Emmers Presson
Support Escalation Engineer
Microsoft Enterprise Platforms Support
Comments
- Anonymous
January 01, 2003
Thanks a lot. It helped me to install Win 8 Language Pack directly from CAB. - Anonymous
January 01, 2003
Hi dj_palindrome,What stops you from going the same approach with DISM?Dism.exe /online /add-package /packagepath:"C:Usersi0028lDownloadsupdate-bf.mum"This works perfectly for me. - Anonymous
January 01, 2003
Please could you tell me how to uninstall a package installed in this way, if you no longer have the file in the Temp Directory? - Anonymous
January 01, 2003
The comment has been removed - Anonymous
January 01, 2003
I get error (0x800f0902) (CBS busy) on sequenced DISM-calls. What could be the reason?I cannot use "cmd.exe /c START /WAIT", because I need the return values. - Anonymous
January 01, 2003
@OdgeUKWell, how about this?.Dism.exe /Online /Remove-Package /PackageName:"Package_for_KB1234567~31bf3856ad364e35~amd64~~6.2.1.0"The list of installed packages and their respective names can be obtained by running.Dism.exe /Online /Get-Packages - Anonymous
January 01, 2003
Very clear post.May I ask if it is possible through DISM (or through other tools) to list all files that are changed for an hotfix?Many Thanks - Anonymous
January 01, 2003
The comment has been removed - Anonymous
January 01, 2003
The comment has been removed - Anonymous
January 01, 2003
Thanks a lot. It helped me to install Win 8 Language Pack directly from CAB. - Anonymous
January 01, 2003
Thanks - Anonymous
January 01, 2003
Can we extract multiple MSU file to cab? I mean if you have 100 updates then you not need to write command 100 times. - Anonymous
February 16, 2011
Good rundown Emmers.I've used this method to install IE offline, except that I point the PackagePath to the XML file (answerfile) in the expanded source. It works well. Fast and avoids a reboot.Can you explain why OS service packs cannot be installed using MSU technology? That is, why can't service packs be installed offline?One more off topic question. DISM can do many imaging and deployment related tasks, except that it cannot create catalog (.clg) files. This prevents the entire build process being automated, as modifying an offline image would require a new catalog file be created. Any chance of a /make-catalog switch in a future DISM update? - Anonymous
November 02, 2011
Very useful post. I had tried the same thing than you (just put .MSU in a folder and try to call DISM to install), but didn't found the file. Now works fine after expanding.Thanks. - Anonymous
October 18, 2013
For multiple MSUsDownload MSU files manually from microsoft download centre.Extract the cab files using:Expand -F:* [MSUs folder*] [CAB destination folder]Install using DISM using:DISM /online /add-package /packagepath:[CAB destination folder] - Anonymous
October 19, 2013
thanks a lot... - Anonymous
December 04, 2013
I followed all the steps and I still get an error. I'm running a w2k8 r2 esx 5.1 vm receiving the scecli error event 1201 no mapping between account names error. Hotfix KB974639 is suppose to fix this. Its a .msu file. After following all of the above steps I receive an error 0x800f081e The specified package is not applicable to this image. Any ideas what I may have missed. - Anonymous
December 09, 2013
Clear and usefulThanks. - Anonymous
March 12, 2014
How can I run to multiple machines? I tried to do a script but it dosn't work because need elevated permission on Windows 7. I am stuck with that. - Anonymous
May 05, 2014
HI I would like to update server Windows 2012 and download msu file of Microsoft AND I have no internet on server IM Type msu file > Expand –F:* c:kb976571Windows6.1-KB976571-v2-x64.msu c:temp976571 and type >> DISM.exe /Online /Remove-Package /PackagePath:c:temp976571Windows6.1-KB976571-v2-x64.cab
BUT Back to me ERROR
An error occurred trying to open -c:tempwindows6.1........cab Error :0x80070307 - Anonymous
May 05, 2014
HI I would like to update server Windows 2012 and download msu file of Microsoft AND I have no internet on server IM Type msu file > Expand –F:* c:kb976571Windows6.1-KB976571-v2-x64.msu c:temp976571 and type >> DISM.exe /Online /Remove-Package /PackagePath:c:temp976571Windows6.1-KB976571-v2-x64.cab
BUT Back to me ERROR
An error occurred trying to open -c:tempwindows6.1........cab Error :0x80070307 - Anonymous
May 05, 2014
HI I would like to update server Windows 2012 and download msu file of Microsoft AND I have no internet on server IM Type msu file > Expand –F:* c:kb976571Windows6.1-KB976571-v2-x64.msu c:temp976571 and type >> DISM.exe /Online /Remove-Package /PackagePath:c:temp976571Windows6.1-KB976571-v2-x64.cab
BUT Back to me ERROR
An error occurred trying to open -c:tempwindows6.1........cab Error :0x80070307 - Anonymous
May 05, 2014
HI I would like to update server Windows 2012 and download msu file of Microsoft AND I have no internet on server IM Type msu file > Expand –F:* c:kb976571Windows6.1-KB976571-v2-x64.msu c:temp976571 and type >> DISM.exe /Online /Remove-Package /PackagePath:c:temp976571Windows6.1-KB976571-v2-x64.cab
BUT Back to me ERROR
An error occurred trying to open -c:tempwindows6.1........cab Error :0x80070307 - Anonymous
June 12, 2014
Hi Emmers.. I have another query.. I am trying to uninstall a patch from a 2008 server that has blue screened. I am using DISM /image with remove-package switch. Obviously i do this from recovery environment X:.. The command executes fine and i get 100%. But after i reboot and use the get-packages command.. i see the patch is still there with a "pending install" comment. Can you advise some way to get the patch removed fully from recovery command prompt. Thanks in advance :) - Anonymous
September 30, 2014
If the cab files all ready downloaded on a single computer, do you still need the /online switch to install the cab file? DISM.exe /Online /Add-Package /PackagePath:c:temp976571Windows6.1-KB976571-v2-x64.cab - Anonymous
November 06, 2014
Do you have any ideas on how to improve the installation time of a batch of hotfixes?
I go from just 50 minutes to 3 hrs with the all the new hotfixes.
thank you,
Teddy - Anonymous
November 23, 2014
The comment has been removed - Anonymous
May 10, 2015
Thanks for useful info.
How you deal with lot of updates in CAB file and inside numerous different folders?
I 'm trying to use using Recurse and other bits but no avail
C:TempOfflineUpdates>Dism /Online /Add-Package /PackagePath:"C:TempSoftwareU
pdates2015" /IgnoreCheck
Deployment Image Servicing and Management tool
Version: 6.1.7600.16385
Image Version: 6.1.7601.18489
An error occurred trying to open - C:TempSoftwareUpdates2015" /IgnoreCheck Err
or: 0x80070003
Error: 3
The system cannot find the path specified.
Any suggestions?
Thanks in advance
Regards
Anish - Anonymous
October 05, 2015
Many thanks!
I have use many method to install a fix , and it's the only one which worked for me! - Anonymous
November 12, 2015
Why not just use WUSA to install the MSU files?- Anonymous
July 10, 2016
WUSA Its slooow. DISM just inject the update.
- Anonymous
- Anonymous
November 12, 2015
Error: 2
The system cannot find the file specified.
I know I'm typing the path correctly... - Anonymous
January 28, 2016
Thanks, I found this very helpful. I Struggled with installing a patch for most of the day until I found this post. - Anonymous
August 01, 2016
Thanks for the great tips :D - Anonymous
September 30, 2016
This doesn't work on Win 10 1607All you get is error 87 - Anonymous
May 24, 2017
tremendously helpful. may you live a long and happy life. - Anonymous
June 21, 2017
I have tried multiple times to do the expand command in Windows 7 computer with AMD Carrizo DDR4 processor and cannot find the file. Do you have any other suggestions? Thanks! - Anonymous
July 21, 2018
Need help in these steps:1. Create a c:\temp\976571 folder.2. Use the following command to extract the contents of the MSU file:Expand –F:* c:\kb976571\Windows6.1-KB976571-v2-x64.msu c:\temp\976571This resulted in extracting multiple files, which included the Windows6.1-KB976571-v2-x64.cab file.I have cab files.1) Do I press Windows + R and then in the folder, add a folder with the CAB name?2) Expand –F:* c:\kb976571\Windows6.1-KB976571-v2-x64.msu c:\temp\976571 entered in CMD?example: file name is Intel.cab. Does that mean it should be? –F:* c:\Intel\Intel c:\temp\IntelFor this: DISM.exe /Online /Add-Package /PackagePath:c:\temp\976571\Windows6.1-KB976571-v2-x64.cabI should enter: DISM.exe /Online /Add-Package /PackagePath:c:\temp\Intel\Intel.cab - Anonymous
August 01, 2018
Thank you! This helps with KB4340558 update