How to use DISM to install a hotfix from within Windows

本文详细介绍了如何使用Deployment Image Servicing and Management (DISM)工具从Windows内部安装热修复或任何其他“包”。通过逐步指导,展示了如何将MSU文件转换为CAB文件,并使用DISM在线安装这些更新,解决直接安装MSU文件不被支持的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

 

 

How to use DISM to install a hotfix from within Windows

https://blogs.technet.microsoft.com/askcore/2011/02/15/how-to-use-dism-to-install-a-hotfix-from-within-windows/

February 15, 2011 by Jeff Hughes (MSFT) // 39 Comments

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:

http://windowsteamblog.com/windows/b/springboard/archive/2009/07/28/managing-windows-7-with-dism.aspx

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

Back to
top

 

 

Search this blog Search all blogs

Top Server & Tools Blogs

EPS Team Blogs

Product Team Blogs

Recent Posts

Tags

Activation Backup/Restore Bitlocker Chris Butcher Chuck Timon Deployment Disaster Recovery DPM Failover Cluster Himanshu Singh Hyper-V James Burrage Jeff Hughes John Marlin Joseph Conway Keith Hill Manoj Sehgal MBAM (Microsoft BitLocker Administration and Monitoring) Mike Rosado Naziya Shaik Pages Performance Robert Mitchell Scott McArthur SCVMM Sean Dwyer Servicing Shannon Gowen Steven Graves Storage and File Storage and File Systems Surface Vic Reavis Vimal Shekar Windows 7 Windows 8 Windows 8.1 Windows 10 Windows 2012 Windows Server 2008 Windows Server 2008 R2 Windows Server 2012 Windows Server 2012 R2 Windows Server 2016 Windows Vista

Archives

  1. 50 years ago

    Anonymous

    Thanks a lot. It helped me to install Win 8 Language Pack directly from CAB.

  2. 50 years ago

    Pronichkin

    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.

  3. 50 years ago

    OdgeUK

    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?

  4. 50 years ago

    Markus Ruppel

    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

  5. 50 years ago

    ThiloL

    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.

  6. 50 years ago

    Pronichkin

    @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

  7. 50 years ago

    Anonymous

    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

  8. 50 years ago

    dj_palindrome

    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

  9. 50 years ago

    Pronichkin

    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.

  10. 50 years ago

    Anonymous

    Thanks a lot. It helped me to install Win 8 Language Pack directly from CAB.

  11. 50 years ago

    Knuckle-Dragger

    Thanks

  12. 50 years ago

    Anonymous

    Can we extract multiple MSU file to cab? I mean if you have 100 updates then you not need to write command 100 times.

  13. 9 years ago

    Drewfus

    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?

  14. 8 years ago

    Eduardo Oliveira

    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.

  15. 6 years ago

    Clampatron

    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]

  16. 6 years ago

    Metamorphosis

    thanks a lot…

  17. 6 years ago

    kdmilliken

    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.

  18. 6 years ago

    Apple xu

    Clear and useful

    Thanks.

  19. 6 years ago

    Sonia Aguayo

    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.

  20. 5 years ago

    tahereh

    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

  21. 5 years ago

    tahereh

    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

  22. 5 years ago

    tahereh

    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

  23. 5 years ago

    tahereh

    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

  24. 5 years ago

    VijayPV

    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 

  25. 5 years ago

    Greg Lambert

    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

  26. 5 years ago

    Teddy

    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

  27. 5 years ago

    P4

    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.

  28. 4 years ago

    Anish

    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

  29. 4 years ago

    fullflash

    Many thanks!
    I have use many method to install a fix , and it's the only one which worked for me!

  30. 4 years ago

    Jimm

    Why not just use WUSA to install the MSU files?

    • 3 years ago

      john

      WUSA Its slooow. DISM just inject the update.

  31. 4 years ago

    Help

    Error: 2
    The system cannot find the file specified.

    I know I'm typing the path correctly…

  32. 4 years ago

    Tim

    Thanks, I found this very helpful. I Struggled with installing a patch for most of the day until I found this post.

  33. 3 years ago

    Graham Ansell

    Thanks for the great tips ?

  34. 3 years ago

    ash

    This doesn’t work on Win 10 1607
    All you get is error 87

  35. 2 years ago

    john smith

    tremendously helpful. may you live a long and happy life.

  36. 2 years ago

    Ana Cummings

    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!

  37. 1 year ago

    Paul P Chou

    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

  38. 1 year ago

    Gekus

    Thank you! This helps with KB4340558 update

Comments are closed.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值