每日更新 · 智能硬件产业情报
AI 快讯 Figure

Using DISM to install Windows updates

Windows’ built-in Deployment Image Servicing and Management (DISM) command, a.k.a. dism.

Using DISM to install Windows updates

Windows’ built-in Deployment Image Servicing and Management (DISM) command, a.k.a. dism.exe , is something of a Swiss Army knife when it comes to working on Windows OS images. Among its many capabilities — such as adding optional Windows features and packages, taking image inventories, performing image cleanups, and more — DISM includes an /Add-Package option. This option allows users to install Microsoft Catalog updates in .cab or .msu files to a targeted Windows image.

.cab is short for “ Windows Cabinet ,” a type of compressed file that stores data and instructions for Windows that can update device drivers, system files, and so forth. The .msu file extension is associated with the Microsoft Update Standalone Installer . Normally, this installer uses the Windows Update Agent API to install update packages. Both .cab and .msu files also work with the DISM command against Windows image files, which may be of types .wim, .wsm, .esd, .ffu, or virtual hard disk files of type .vhd or .vhdx.

Note that .msu updates only work on offline images, while the more common .cab files may be applied to an online image to update a running Windows install. If an .msu is the only format available for download, you can sometimes use a tool like expand.exe (built into Windows 10 and 11) to extract a .cab file that DISM can apply to online images. See this Microsoft Learn article for details: only a couple of extra steps are involved.

That said, Windows 11 updates invariably come in the form of .msu files. Perhaps worse from a DISM perspective: they do not readily cough up .cab files suitable for use on an online image. Thus, this workaround is really only suited for Windows 10.

At the end of this story, I’ll explain what you must do to take an image offline and work on it. Most readers — except for IT pros and software developers — are likely to say “Heck, no!”

Why use DISM instead of Windows Update?

Good question! Sometimes, DISM provides a way to install an update when Windows Update (WU) may have issues. At times, Windows Update may simply refuse to work, or it may hang or crash for some particular update. Thankfully, DISM provides a handy way to install updates when WU itself may be unable to oblige.

Other scenarios when you might want to use DISM instead of Windows images include:

Managing Windows images for large-scale and/or remote deployments using Microsoft Intune, Windows Autopilot, or Systems Center Configuration Manager (SCCM).

Slipstreaming drivers or updates into standard Windows images for customization and special deployments.

As an alternative to user-driven updates from an in-house update server, perhaps during scheduled maintenance periods. Holiday weekends are popular for this kind of thing in large organizations, because they provide an extra day to fix unexpected problems or to roll back to the previous status quo if such problems can’t be fixed.

Where to find Windows Update files

The Microsoft Update Catalog is the most common source for update files of all types, including .cab and .msu. Generally, items are accessed by name (e.g., Realtek Audio Driver) or by Knowledge Base (KB) article number. For example, KB5066791 is an update that applies to Windows 10 21H2 and 22H2 (the most current version); it includes bug fixes and resolutions.

Figure 1 shows the Update Catalog the search results for KB5066791. Click the Download button in the right-hand column for the version of the file that matches the target OS to get the update.

Figure 1: This security update for Windows 10 21H2 and 22H2 includes bug fixes and resolutions.

Ed Tittel / Foundry

I clicked the download button for the seventh item from the top, because it matches my target PC’s OS version (22H2) and architecture (x64). This provides a link to an .msu with an extremely long filename: windows10.0-kb5066791-arm64_28dfd4874e2cd23882608cdcba89a9cc2132d677.msu .

Making the .cab conversion

Here’s the step-by-step syntax to unpack the .cab file from the downloaded .msu. For isolation and convenience, I moved it into D:\Temp from its original location (my personal Downloads folder). Figure 2 shows the contents of the .msu file as seen from within the popular archive-handling application 7-Zip. It’s trivial simply to extract the .cab file from inside 7-Zip, where it appears as Windows10.0-KB5066791-x64.cab .

Figure 2: 7-Zip makes it dead easy to grab the .cab (item 3, from top).

Ed Tittel / Foundry

Alternatively, you can use the built-in Windows command expand.exe to do the same job from a command line terminal:

expand -F:* " windows10.0-kb5066791-x64_3210d264091be5effb3253d05397c4daefba44c8.msu" "KB5066791-x64.cab"

Now that you’ve got access to the update in both .cab and .msu formats, DISM can work against both online (.cab) and offline (.msu) images. Let’s dig into the online syntax next.

The DISM /Add-Package syntax

The DISM command is fully documented online in Microsoft Docs in the DISM Operating System Package… Servicing Command-Line Options pages. This is just a small part of the Deployment Tools Reference , another online document worth bookmarking and exploring for those who work with (and on) Windows images.

The manual lays out the abstract syntax for the /Add-Package option as follows:

Dism /Add-Package /PackagePath: [/IgnoreCheck] [/PreventPending]

A /PackagePath can point to a single .cab or .msu file, a folder that contains a single expanded .cab file or a single .msu file, or a folder that contains multiple .cab or .msu files. (You can’t mix the two types, however.) If /PackagePath points to a folder that contains one or more .cab or .msu files at its root, any subfolders will be likewise recursively checked for such files as well.

The /PreventPending switch instructs DISM to skip installing the package if it, or the targeted Windows image, has any uncompleted actions still pending. This is intended to prevent DISM from operating on images that may not be complete or intact.

As already stated, you can add multiple packages within a single DISM command by including multiple .cab or .msu files in the directory that serves as input to the /PackagePath option. Ordinarily, DISM will check each package to make sure it’s applicable to the targeted image. If a package will not apply to that image, DISM will issue an error message. The /IgnoreCheck switch may be used to get DISM to run silently and skip the applicability check for each package.

DISM /Add-Package example

Let’s say I’m running a 64-bit (x64 architecture, not ARM) version of Windows 10 22H2. If I wanted to apply KB5066791 to that running image, I’d need to download the corresponding .msu file and extract the .cab file for online image use. Figure 3 shows the syntax in PowerShell/Windows Terminal.

Figure 3: The proper syntax for DISM /Add-Package for a running Windows system.

Ed Tittel / Foundry

Some key observations for clarity and brevity:

DISM only works with administrative privileges, so you must be logged into an administrative account and opt for “run as administrator” for your command line environment.

The /Online switch tells DISM to apply packages to the currently running Windows image.

I renamed the .cab file to KB5066791-x64.cab so I could fit everything into a single line of text.

The actual command that appears in Figure 3 reads:

DISM /Online /Add-Package /PackagePath:D:\Temp\KB5066791-x64.cab

To run the command in this way, you must be sure there are no Windows Update transactions pending. The safest way to make sure this is true is to restart the system before running any DISM /Add-Package commands.

Working on offline images is something of a specialty exercise.

本文由 白泽自动聚合自 Computerworld,发布时间:2025-12-28。内容与图片版权归原作者所有,本站仅作信息整理。
RSS 订阅

本文提到的对象

已选 0 款产品 开始对比