How to use DISM to install a hotfix from within Windows

你的名字 2024-04-18 21:06 180阅读 0赞

#

#

#

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

format_png

  • ScottGu’s Blog
  • Brad Anderson’s “In the Cloud” Blog
  • Brian Harry’s Blog
  • Steve “Guggs” Guggenheimer’s Blog

EPS Team Blogs

  • ASK Perf Blog
    Memory Management, Performance, Printing, Terminal Server
  • CPR / Escalation Services
    Debugging, Hangs, Tools
  • Directory Services
    DFSR, Certificates, Group Policy
  • LATAM [Portugese & Spanish]
    Espanol, Portugues
  • Manageability
    SMS MOM
  • Networking
    Scalable Networking, OCS, Communications Server
  • Small Business Server
    Windows Essential Business Server
  • SoftGrid
    Microsoft Application Virtualization, SoftGrid, Softricity
  • Data Protection Manager (DPM)
    DPM related issues
  • Microsoft Deployment Team Blog
    BDD Team
  • Vista
    Vista Team Blog
  • Microsoft GTSC Romania - Enterprise Platforms Support
    Microsoft GTSC Bucharest / Covering topics such as: Windows Server, Failover Clustering, Performance, Printing, Core OS, AD, Deployment, WSUS, SCOM/SCCM

Product Team Blogs

  • Virtualization
  • DPM
  • Clustering
  • Windows Server

Recent Posts

  • CROSSPOST: New Server Management Tool: Project Name “Honolulu” September 14, 2017
  • High CPU/High Memory in WSUS following Update Tuesdays August 18, 2017
  • Enabling Surface Laptop keyboard during MDT deployment August 18, 2017
  • Deploy Windows from USB drive to Surface Studio June 14, 2017

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

  • September 2017 (1)
  • August 2017 (2)
  • June 2017 (2)
  • May 2017 (2)
  • April 2017 (1)
  • March 2017 (4)
  • February 2017 (1)
  • January 2017 (1)
  • November 2016 (2)
  • All of 2017 (14)
  • All of 2016 (16)
  • All of 2015 (25)
  • All of 2014 (31)
  • All of 2013 (43)
  • All of 2012 (48)
  • All of 2011 (45)
  • All of 2010 (41)
  • All of 2009 (63)
  • All of 2008 (61)
  • All of 2007 (8)
  1. 50 years ago

    format_png 2

    Anonymous

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

  2. 50 years ago

    format_png 3

    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

    format_png 4

    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

    format_png 5

    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

    format_png 6

    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

    format_png 3

    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

    format_png 7

    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

    format_png 8

    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

    format_png 3

    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

    format_png 2

    Anonymous

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

  11. 50 years ago

    format_png 9

    Knuckle-Dragger

    Thanks

  12. 50 years ago

    format_png 10

    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

    format_png 2

    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

    format_png 2

    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

    format_png 2

    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

    format_png 2

    Metamorphosis

    thanks a lot…

  17. 6 years ago

    format_png 2

    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

    format_png 2

    Apple xu

    Clear and useful

    Thanks.

  19. 6 years ago

    format_png 2

    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

    format_png 2

    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

    format_png 2

    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

    format_png 2

    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

    format_png 2

    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

    format_png 2

    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

    format_png 11

    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

    format_png 12

    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

    format_png 2

    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

    format_png 2

    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

    format_png 2

    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

    format_png 13

    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

    format_png 2

    Help

    Error: 2
    The system cannot find the file specified.

    I know I’m typing the path correctly…

  32. 4 years ago

    format_png 14

    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

    format_png 15

    Graham Ansell

    Thanks for the great tips ?

  34. 3 years ago

    format_png 17

    ash

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

  35. 2 years ago

    format_png 18

    john smith

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

  36. 2 years ago

    format_png 19

    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

    format_png 20

    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

    format_png 21

    Gekus

    Thank you! This helps with KB4340558 update

Comments are closed.

发表评论

表情:
评论列表 (有 0 条评论,180人围观)

还没有评论,来说两句吧...

相关阅读

    相关 how to use kvm

    kvm 是qemu 集成了一些針對開啟了VT技術的cpu而開發的不錯的內核級程式. 下面是一些簡要的說明:- <table style="border:1px solid