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 (http://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
Thanks a lot. It helped me to install Win 8 Language Pack directly from CAB.
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.
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?
Emmers,
on Win 8.1 pro (running on a Surface Pro 3, updated with all available patches as of today), I execute the following command:
dism /online /add-package /packagepath:c:name.cab
"Name.cab" had been downloaded directly from catalog.update.microsoft.com.
The output is:
…
Image Version: 6.3.9600.17031
An error occurred trying to open – c:sigtel.cab Error: 0x80070002
Error: 2
The system cannot find the file specified.
…
In dism.log I find:
Failed opening package. – CDISMPackageManager::Internal_CreatePackageByPath(hr:0x80070002)
Failed to get the underlying CBS package. – CDISMPackageManager::OpenPackageByPath(hr:0x80070002)
Failed to open the package at location: "c:name.cab" –
http://blogs.technet.com/b/askcore/archive/2011/02/15/how-to-use-dism-to-install-a-hotfix-from-within-windows.aspx#CPackageManagerCLIHandler::ProcessPackagePath(hr:0x80070002)
What would be the "underlying CBS package"?
Using DISM, I could verify that there is no component store corruption.
Any help would be appreciated!
Thanks,
Markus Ruppel
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.
@OdgeUK
Well, 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
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
Might I ask how to install LDR (QFE) hotfix service branches from the command line using DISM?
I'll admit I'm afraid of DISM syntax, so I use something like "pkgmgr /ip /m:update-bf.mum /log:pkgmgr_x64" after expanding the CAB file inside the MSU package.
I know that the use of pkgmgr is deprecated and it is actually shimmed to call DISM. However even the DISM logs look scary ;-o
Not with dism, but you can use standard “double expand” approach or a tool like CBS Package Inspector (archive.msdn.microsoft.com/packageinspector). The latter is designed specifically for Windows Embedded, but since the Component stack is the same, it works for regular Windows packages just fine.
Thanks a lot. It helped me to install Win 8 Language Pack directly from CAB.
Thanks
Can we extract multiple MSU file to cab? I mean if you have 100 updates then you not need to write command 100 times.
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?
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.
For multiple MSUs
Download 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]
thanks a lot…
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.
Clear and useful
Thanks.
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.
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
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
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
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
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 🙂
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
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
Hello. Great article indeed clean and straight forward, however I have exactly the same problem as reported by Markus Ruppel on 19 Nov 2014 11:36 PM.
I'm trying to install Windows6.1-KB958559-x64-RefreshPkg.msu on my Windows Technical Preview Build 9860. After expanding the msu package and invoking DISM.exe /Online /Add-Package /PackagePath:Windows6.1-KB958559-x64-RefreshPkg.cab I receive an error: The implementation
is not capable of performing the request. Looking into dism.log and then CBS.log I can read the following errors that occured:
http://pastebin.com/w0XqVvin
Would you be so kind to comment on the above, please?
How to successfully install the package downloaded from
http://www.microsoft.com/en-US/download/details.aspx?id=3702 on my machine?
After running Windows6.1-KB958559-x64-RefreshPkg.msu directly I get Windows Update Standalone Installer error of 0x80096002: The certificate for the signer of the message is invalid or not found thus I followed your post.
Running havdetectiontool.exe in Windows 7 compatibility mode brings me information that Hardware-Assisted Virtualization is not available on my box but I don't think it is a reason of described problem. VMWare Worksation 9 and 10 had no issues running on this
hardware.
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
Many thanks!
I have use many method to install a fix , and it's the only one which worked for me!
Why not just use WUSA to install the MSU files?
WUSA Its slooow. DISM just inject the update.
Error: 2
The system cannot find the file specified.
I know I'm typing the path correctly…
Thanks, I found this very helpful. I Struggled with installing a patch for most of the day until I found this post.
Thanks for the great tips 😀
This doesn’t work on Win 10 1607
All you get is error 87
tremendously helpful. may you live a long and happy life.
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!
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\976571
This 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\Intel
For this: DISM.exe /Online /Add-Package /PackagePath:c:\temp\976571\Windows6.1-KB976571-v2-x64.cab
I should enter: DISM.exe /Online /Add-Package /PackagePath:c:\temp\Intel\Intel.cab
Thank you! This helps with KB4340558 update