cheat sheet
dism
Service Windows images and the running OS — enable/disable optional features, repair the component store, mount and edit WIM/ESD images, add drivers, and manage editions from an elevated command prompt.
dism — Deployment Image Servicing and Management
What it is
dism (Deployment Image Servicing and Management) is the built-in Windows command-line tool for inspecting and modifying Windows images — both the running operating system (/Online) and offline .wim / .esd / mounted VHDs (/Image:<path>). It is the engine behind feature installs, component-store repair (sfc calls dism under the hood when its own cache is corrupt), driver injection during deployment, edition upgrades, and OEM image servicing. dism ships in C:\Windows\System32\dism.exe on Windows 7 and later and requires an elevated console; the PowerShell equivalents (Get-WindowsOptionalFeature, Add-WindowsPackage, Repair-WindowsImage) wrap the same APIs and are friendlier for scripting.
Availability
dism ships with Windows 7 / Server 2008 R2 and later. Almost every subcommand requires Administrator rights — open the prompt with right-click → "Run as administrator" or via runas /user:Administrator cmd.exe.
dism /?
Output:
Deployment Image Servicing and Management tool
Version: 10.0.26100.1
DISM enumerates, installs, uninstalls, configures, and updates
features and packages in Windows images.
DISM /Online /Cleanup-Image /Restorehealth
DISM /Image:C:\test\offline /Get-Features
DISM /Mount-Image /ImageFile:install.wim /Index:1 /MountDir:C:\mount
...
Syntax
dism commands fall into three target categories: /Online (the running OS), /Image:<path> (an offline mounted image), and image-management commands that operate on .wim/.esd files directly. Most subcommands take additional namespaced options like /Cleanup-Image, /Add-Package, /Get-Features.
dism {/Online | /Image:<path> | /Get-WimInfo /WimFile:<file>} [/CommandArgs...] [/LogPath:<file>] [/LogLevel:N]
Output: (varies — most successful commands end with The operation completed successfully.)
Essential options
| Switch | Meaning |
|---|---|
/Online | Target the running OS |
/Image:<path> | Target an offline image mounted at <path> |
/Get-Features | List optional features and their state |
/Get-FeatureInfo /FeatureName:<name> | Detail for a single feature |
/Enable-Feature /FeatureName:<name> | Enable an optional feature |
/Disable-Feature /FeatureName:<name> | Disable an optional feature |
/All | Recursively enable parent features required by the requested one |
/LimitAccess | Skip Windows Update; install from local source only |
/Source:<path> | Path to a sources\sxs folder for feature payloads |
/Cleanup-Image /CheckHealth | Quick component-store integrity report |
/Cleanup-Image /ScanHealth | Deeper scan (slow) |
/Cleanup-Image /RestoreHealth | Repair from Windows Update or /Source |
/Cleanup-Image /AnalyzeComponentStore | Report WinSxS size and whether cleanup is recommended |
/Cleanup-Image /StartComponentCleanup | Remove superseded components from WinSxS |
/Get-Packages | List installed packages (KBs, language packs) |
/Add-Package /PackagePath:<file> | Install a .msu or .cab |
/Remove-Package /PackageName:<name> | Remove an installed package |
/Get-Drivers | List third-party drivers |
/Add-Driver /Driver:<inf> | Inject a driver (offline image) |
/Get-WimInfo /WimFile:<file> | Enumerate indices inside a WIM/ESD |
/Mount-Image /ImageFile:<file> /Index:N /MountDir:<dir> | Mount an image for editing |
/Commit-Image /MountDir:<dir> | Save changes to a mounted image |
| `/Unmount-Image /MountDir: /{Commit | Discard}` |
/Get-CurrentEdition | Show the running edition |
/Get-TargetEditions | Editions you can step up to |
/Set-Edition:<edition> /ProductKey:<key> | Step up to a higher edition |
/LogPath:<file> | Override default log location (%WINDIR%\Logs\DISM\dism.log) |
/LogLevel:N | 1=errors, 2=+warnings, 3=+info, 4=+debug |
/English | Force English output for predictable parsing |
Component-store health
The component store (C:\Windows\WinSxS) is the master copy of every Windows component. When system files are corrupt — flaky sfc /scannow results, failed updates, "DLL not found" errors — dism /Cleanup-Image is the canonical repair path. There are three escalating checks: /CheckHealth is a quick flag read, /ScanHealth walks the store, and /RestoreHealth re-downloads any damaged payloads.
rem 1. Quick check — reads cached health flag (seconds)
dism /Online /Cleanup-Image /CheckHealth
Output:
Deployment Image Servicing and Management tool
Version: 10.0.26100.1
Image Version: 10.0.26100.1
No component store corruption detected.
The operation completed successfully.
rem 2. Deeper scan — actually verifies each component (5-20 minutes)
dism /Online /Cleanup-Image /ScanHealth
Output:
[==========================100.0%==========================]
No component store corruption detected.
The operation completed successfully.
rem 3. Repair — pulls fresh payloads from Windows Update
dism /Online /Cleanup-Image /RestoreHealth
Output:
[==========================100.0%==========================]
The restore operation completed successfully.
The operation completed successfully.
rem Offline repair from a known-good install.wim source
dism /Online /Cleanup-Image /RestoreHealth /Source:WIM:D:\sources\install.wim:1 /LimitAccess
Output:
[==========================100.0%==========================]
The restore operation completed successfully.
Reclaiming disk in WinSxS
After every monthly update, superseded versions of components linger in WinSxS so the update can be rolled back. /AnalyzeComponentStore reports how much space is reclaimable; /StartComponentCleanup lets the system drop those backups; add /ResetBase to make the cleanup permanent (no rollback possible, but the smallest disk footprint).
rem 0. Report — how big is WinSxS and is cleanup recommended?
dism /Online /Cleanup-Image /AnalyzeComponentStore
Output:
[==========================100.0%==========================]
Component Store (WinSxS) information:
Windows Explorer Reported Size of Component Store : 10.62 GB
Actual Size of Component Store : 8.31 GB
Shared with Windows : 5.95 GB
Backups and Disabled Features : 1.92 GB
Cache and Temporary Data : 0.44 GB
Date of Last Cleanup : 2026-04-08 03:14:22
Number of Reclaimable Packages : 14
Component Store Cleanup Recommended : Yes
The operation completed successfully.
dism /Online /Cleanup-Image /StartComponentCleanup
Output:
[==========================100.0%==========================]
The operation completed successfully.
rem Aggressive: no rollback possible afterwards
dism /Online /Cleanup-Image /StartComponentCleanup /ResetBase
Output:
[==========================100.0%==========================]
The operation completed successfully.
Listing and enabling optional features
Optional features are the modular slices of Windows (WSL, Hyper-V, IIS, Telnet client, etc.) that can be turned on and off without reinstalling the OS. /Get-Features lists them all; /Enable-Feature activates one. The exact feature names come from dism /Online /Get-Features and are case-sensitive when scripted.
rem List every optional feature on this machine
dism /Online /Get-Features
Output:
Features listing:
Feature Name : Containers
State : Disabled
Feature Name : Microsoft-Hyper-V-All
State : Disabled
Feature Name : Microsoft-Hyper-V-Hypervisor
State : Disabled
Feature Name : Microsoft-Windows-Subsystem-Linux
State : Disabled
Feature Name : VirtualMachinePlatform
State : Disabled
Feature Name : TelnetClient
State : Disabled
...
The operation completed successfully.
rem Detail for a single feature — shows the parent dependency tree
dism /Online /Get-FeatureInfo /FeatureName:Microsoft-Hyper-V-All
Output:
Feature Information:
Feature Name : Microsoft-Hyper-V-All
Display Name : Hyper-V
Description : Provides services and management tools for creating
and running virtual machines and their resources.
Restart Required : Possible
State : Disabled
Custom Properties:
ServerComponent\Description : Provides services...
ServerComponent\DisplayName : Hyper-V
ServerComponent\Id : 20
ServerComponent\Parent : Microsoft-Hyper-V
The operation completed successfully.
rem Enable WSL non-interactively — /NoRestart suppresses the reboot prompt
dism /Online /Enable-Feature /FeatureName:Microsoft-Windows-Subsystem-Linux /All /NoRestart
Output:
[==========================100.0%==========================]
The operation completed successfully.
Restart Windows to complete this operation.
rem Disable a feature
dism /Online /Disable-Feature /FeatureName:TelnetClient /NoRestart
Output:
[==========================100.0%==========================]
The operation completed successfully.
Filtering features with findstr
/Get-Features is verbose. Pipe it through findstr to grep by name or state for fast inventories.
rem Only enabled features
dism /Online /Get-Features /Format:Table | findstr /C:"Enabled"
Output:
WCF-Services45 | Enabled
WCF-TCP-PortSharing45 | Enabled
SmbDirect | Enabled
Internet-Explorer-Optional-amd64 | Enabled
rem Only Hyper-V related features
dism /Online /Get-Features | findstr /I /C:"Hyper"
Output:
Feature Name : Microsoft-Hyper-V-All
Feature Name : Microsoft-Hyper-V
Feature Name : Microsoft-Hyper-V-Tools-All
Feature Name : Microsoft-Hyper-V-Management-PowerShell
Feature Name : Microsoft-Hyper-V-Hypervisor
Packages — KBs and language packs
Packages are pre-built installers (.msu, .cab) that ship updates, language packs, and OEM customizations. /Get-Packages lists them; /Add-Package and /Remove-Package install or remove them on the running OS or an offline image.
rem List installed packages with install state
dism /Online /Get-Packages /Format:Table
Output:
Package Identity | State | Release Type | Install Time
----------------------------------------------------------|------------|------------------|---------------------
Microsoft-Windows-Foundation-Package~31bf3856ad364e35~... | Installed | Foundation | 01/01/2026 09:15
Package_for_KB5034441~31bf3856ad364e35~amd64~~26100.2... | Installed | Security Update | 28/04/2026 22:01
Package_for_KB5036893~31bf3856ad364e35~amd64~~26100.3... | Installed | Security Update | 15/05/2026 10:22
The operation completed successfully.
rem Install a downloaded .msu update
dism /Online /Add-Package /PackagePath:C:\Updates\windows10.0-kb5034441-x64.msu /NoRestart
Output:
[==========================100.0%==========================]
The operation completed successfully.
Restart Windows to complete this operation.
rem Remove a package by its full identity
dism /Online /Remove-Package /PackageName:Package_for_KB5034441~31bf3856ad364e35~amd64~~26100.2.1.0
Output:
[==========================100.0%==========================]
The operation completed successfully.
Editions — view and step up
Windows ships in editions (Home, Pro, Enterprise, Education). /Get-CurrentEdition shows the running edition; /Get-TargetEditions lists which ones the running install can be upgraded to without a reinstall; /Set-Edition performs the step-up given a valid product key.
dism /Online /Get-CurrentEdition
Output:
Current edition is:
Current Edition : Professional
The operation completed successfully.
dism /Online /Get-TargetEditions
Output:
Editions that can be upgraded to:
Target Edition : ProfessionalWorkstation
Target Edition : Enterprise
Target Edition : Education
The operation completed successfully.
rem Step up to Enterprise (requires a valid key; reboot required)
dism /Online /Set-Edition:Enterprise /ProductKey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX /AcceptEula
Output:
[==========================100.0%==========================]
Starting to install product key...
Finished installing product key.
Starting to upgrade edition...
The operation completed successfully.
Restart Windows to complete this operation.
Offline image servicing — mount, edit, commit
Image servicing is dism's original purpose: take a Windows install media (install.wim), mount one of its indices to a folder, modify it (add drivers, change features, inject updates), and unmount with /Commit to save the changes back into the WIM. Custom corporate images are built this way.
rem 1. Inspect the WIM — see how many editions are bundled
dism /Get-WimInfo /WimFile:D:\sources\install.wim
Output:
Deployment Image Servicing and Management tool
Version: 10.0.26100.1
Details for image : D:\sources\install.wim
Index : 1
Name : Windows 11 Home
Description : Windows 11 Home
Size : 18,432,000,000 bytes
Index : 2
Name : Windows 11 Pro
Description : Windows 11 Pro
Size : 18,650,000,000 bytes
Index : 3
Name : Windows 11 Enterprise
Description : Windows 11 Enterprise
Size : 18,890,000,000 bytes
The operation completed successfully.
rem 2. Mount the Pro image (index 2) to an empty folder
md C:\mount
dism /Mount-Image /ImageFile:D:\sources\install.wim /Index:2 /MountDir:C:\mount
Output:
[==========================100.0%==========================]
The operation completed successfully.
rem 3. Inject a driver into the mounted image
dism /Image:C:\mount /Add-Driver /Driver:C:\Drivers\custom\custom.inf
Output:
Adding driver: C:\Drivers\custom\custom.inf
The driver package was successfully installed.
The operation completed successfully.
rem 4. Enable a feature inside the offline image
dism /Image:C:\mount /Enable-Feature /FeatureName:Microsoft-Windows-Subsystem-Linux /All
Output:
[==========================100.0%==========================]
The operation completed successfully.
rem 5. Unmount and commit changes back to the WIM
dism /Unmount-Image /MountDir:C:\mount /Commit
Output:
[==========================100.0%==========================]
The operation completed successfully.
rem Or — throw away changes (e.g. you broke something)
dism /Unmount-Image /MountDir:C:\mount /Discard
Output:
[==========================100.0%==========================]
The operation completed successfully.
Driver inventory
/Get-Drivers lists third-party drivers installed in the driver store (C:\Windows\System32\DriverStore\FileRepository). Combined with /Remove-Driver you can purge obsolete drivers from a slimmed-down OEM image.
rem Online: all third-party drivers
dism /Online /Get-Drivers
Output:
Driver packages listing:
Published Name : oem0.inf
Original File Name : custom.inf
Inbox : No
Class Name : Net
Provider Name : Acme Corp
Date : 01/01/2025
Version : 1.2.3.4
Published Name : oem1.inf
Original File Name : printer.inf
Inbox : No
Class Name : Printer
Provider Name : Acme Corp
Date : 12/01/2024
Version : 2.0.0.0
The operation completed successfully.
rem Remove a driver by its Published Name
dism /Online /Remove-Driver /Driver:oem1.inf
Output:
Removing driver package oem1.inf...
The driver package was successfully removed.
The operation completed successfully.
Logs and exit codes
Every dism invocation appends to %WINDIR%\Logs\DISM\dism.log. The verbosity is controlled by /LogLevel (1–4). Exit code 0 is success; 3010 means success but a reboot is required; non-zero non-3010 is a real failure.
rem Run with maximum verbosity to a custom log
dism /Online /Cleanup-Image /RestoreHealth /LogPath:C:\Audit\dism.log /LogLevel:4
Output:
[==========================100.0%==========================]
The restore operation completed successfully.
rem Tail the last 20 lines of the standard log
powershell -Command "Get-Content $env:WINDIR\Logs\DISM\dism.log -Tail 20"
Output:
2026-05-24 10:14:22, Info DISM DISM Provider Store: PID=4520 Connecting to the provider...
2026-05-24 10:14:22, Info DISM API: PID=4520 Successfully launched.
2026-05-24 10:14:23, Info DISM PID=4520 Image session start.
...
rem Check exit code in a script (cmd.exe)
dism /Online /Cleanup-Image /RestoreHealth /NoRestart
if %ERRORLEVEL% EQU 0 echo Success
if %ERRORLEVEL% EQU 3010 echo Success — reboot required
if %ERRORLEVEL% GTR 0 if %ERRORLEVEL% NEQ 3010 echo FAILED: %ERRORLEVEL%
Output:
Success
PowerShell equivalents
For scripted work, prefer the PowerShell wrappers — they return objects, integrate with pipelines, and survive locale changes that break findstr against localized dism output.
# Component-store repair
Repair-WindowsImage -Online -RestoreHealth
# Feature inventory + enable
Get-WindowsOptionalFeature -Online | Where-Object FeatureName -like "*Hyper-V*"
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Hyper-V-All" -All -NoRestart
# Package management
Get-WindowsPackage -Online
Add-WindowsPackage -Online -PackagePath C:\Updates\kb5034441.msu
# Driver management
Get-WindowsDriver -Online -All
Add-WindowsDriver -Online -Driver C:\Drivers\custom
# Edition info
Get-WindowsEdition -Online
Output:
FeatureName : Microsoft-Hyper-V-All
DisplayName : Hyper-V
Description : Provides services and management tools...
RestartRequired : Possible
State : Disabled
Common pitfalls
- Must run elevated — every meaningful
dismcommand requires Administrator. From a regular prompt it fails withError: 740 / Elevated permissions are requiredbefore doing anything. /Onlinevs/Image:confusion —/Onlinemodifies the running OS;/Image:<path>modifies an offline mounted image. Mixing them up either does nothing or breaks an image. Always read the first line of the command.- Mount directory must be empty and on NTFS — the folder you pass to
/MountDirmust exist, be empty, and be on a local NTFS volume; ReFS, network paths, and FAT will fail with cryptic errors. - Localized output breaks
findstr— on a German install, "Enabled" becomes "Aktiviert". Add/Englishto force English strings for any parsing script. /RestoreHealthneeds internet — by default it pulls from Windows Update. On an air-gapped box you must supply/Source:WIM:<file>:<index>or/Source:<folder>and add/LimitAccessto skip the WU attempt./StartComponentCleanup /ResetBaseis one-way — once you reset the base, no installed update can be uninstalled. Run it only after a successful months-old build.dismis single-instance — only onedismoperation can run at a time per machine. A second invocation fails withError: 50 / Another DISM operation is in progress.- Reboot semantics — many feature/package operations return success but require a reboot to apply. Always check for exit code
3010or the trailing "Restart Windows to complete this operation" line in scripts. - Antivirus on
WinSxS— third-party AV scanning the component store can slow/RestoreHealthfrom minutes to hours. ExcludeC:\Windows\WinSxSfor the duration of large repairs. sfc /scannowanddismordering — when both are needed, rundism /Online /Cleanup-Image /RestoreHealthfirst (it repairs the sourcesfcreads from), thensfc /scannow.
Real-world recipes
Enable WSL non-interactively in a provisioning script
A common chunk of a new-machine bootstrap: enable WSL + Virtual Machine Platform, suppress reboots, then reboot once at the end.
@echo off
echo Enabling WSL...
dism /Online /Enable-Feature /FeatureName:Microsoft-Windows-Subsystem-Linux /All /NoRestart
echo Enabling Virtual Machine Platform...
dism /Online /Enable-Feature /FeatureName:VirtualMachinePlatform /All /NoRestart
echo Done. Rebooting in 15 seconds...
shutdown /r /t 15
Output:
Enabling WSL...
[==========================100.0%==========================]
The operation completed successfully.
Restart Windows to complete this operation.
Enabling Virtual Machine Platform...
[==========================100.0%==========================]
The operation completed successfully.
Restart Windows to complete this operation.
Done. Rebooting in 15 seconds...
"Disk full" rescue: clean up WinSxS
After a year of monthly updates, WinSxS can grow to 12+ GB. This recipe reclaims several gigabytes.
dism /Online /Cleanup-Image /StartComponentCleanup
dism /Online /Cleanup-Image /StartComponentCleanup /ResetBase
Output:
[==========================100.0%==========================]
The operation completed successfully.
[==========================100.0%==========================]
The operation completed successfully.
Full Windows repair from a known-good source
Classic "system-files corrupt, Windows Update is broken too" rescue. Mount an install.wim from a matching ISO and use it as the repair source.
rem Assumes D:\ is a mounted Windows ISO of the matching build
dism /Online /Cleanup-Image /RestoreHealth /Source:WIM:D:\sources\install.wim:3 /LimitAccess
sfc /scannow
Output:
[==========================100.0%==========================]
The restore operation completed successfully.
Beginning system scan. This process will take some time.
Beginning verification phase of system scan.
Verification 100% complete.
Windows Resource Protection found corrupt files and successfully repaired them.
Build a customized install image — drivers + WSL pre-enabled
A reusable image for a fleet: mount, inject drivers, enable WSL, commit.
md C:\mount
dism /Mount-Image /ImageFile:D:\sources\install.wim /Index:2 /MountDir:C:\mount
dism /Image:C:\mount /Add-Driver /Driver:C:\Drivers\fleet /Recurse
dism /Image:C:\mount /Enable-Feature /FeatureName:Microsoft-Windows-Subsystem-Linux /All
dism /Image:C:\mount /Enable-Feature /FeatureName:VirtualMachinePlatform /All
dism /Unmount-Image /MountDir:C:\mount /Commit
echo Custom image ready at D:\sources\install.wim (index 2)
Output:
[==========================100.0%==========================]
The operation completed successfully.
Adding driver: C:\Drivers\fleet\nic.inf
The driver package was successfully installed.
Adding driver: C:\Drivers\fleet\gpu.inf
The driver package was successfully installed.
[==========================100.0%==========================]
The operation completed successfully.
[==========================100.0%==========================]
The operation completed successfully.
[==========================100.0%==========================]
The operation completed successfully.
Custom image ready at D:\sources\install.wim (index 2)
Audit: list every non-inbox driver across a fleet
Stash one CSV per host in a share for diff against a baseline.
@echo off
for /f "delims=" %%h in (hostlist.txt) do (
echo Querying %%h...
dism /Image:\\%%h\C$\Windows /Get-Drivers /Format:Table > \\fileserver\audit\drivers_%%h.txt
)
Output:
Querying MYHOST...
Querying SRV01...
Querying SRV02...
Find the package name of a specific KB
dism package names are long and hash-tagged. findstr extracts the matching identity for /Remove-Package.
dism /Online /Get-Packages | findstr /I "KB5034441"
Output:
Package Identity : Package_for_KB5034441~31bf3856ad364e35~amd64~~26100.2.1.0
rem Now remove it cleanly
dism /Online /Remove-Package /PackageName:Package_for_KB5034441~31bf3856ad364e35~amd64~~26100.2.1.0
Output:
[==========================100.0%==========================]
The operation completed successfully.
Restart Windows to complete this operation.
Capture a custom WIM for redeployment
dism /Capture-Image (run from WinPE) snapshots a sysprepped install into a deployable WIM.
rem Run from WinPE booted on the reference machine
dism /Capture-Image /ImageFile:D:\images\golden.wim /CaptureDir:C:\ /Name:"GoldenImage 2026-05" /Compress:max
Output:
[==========================100.0%==========================]
The operation completed successfully.