- Overview
- Variable Conventions
- Step 1: Target Selection (/Online vs /Image)
- Step 2: List Features (/Get-Features, /Get-FeatureInfo)
- Step 3: Enable/Disable Features (/Enable-Feature, /Disable-Feature)
- Step 4: Inspect Capabilities (/Get-Capabilities, /Get-CapabilityInfo)
- Step 5: Add/Remove Capabilities (/Add-Capability, /Remove-Capability)
- Step 6: Image Repair & Component Store (/Cleanup-Image)
- Step 7: Image Info (/Get-ImageInfo)
- Step 8: Mount & Unmount Offline Images
- Step 9: Integrate Drivers, Packages, and Language Packs
- Step 10: Capture, Export, and Apply Images
- Step 11: PowerShell Equivalents
- Summary
Overview
This article treats DISM (Deployment Image Servicing and Management) and PowerShell (the DISM API wrapper) side by side. It organizes frequent admin tasks with concise explanations, key options, and ready-to-run examples.
Variable Conventions
| Variable | Example | Notes |
|---|---|---|
<<IMAGE_PATH>> |
C:\mount or E:\Windows |
Path for /Image: (mounted offline Windows or another disk’s Windows directory) |
<<FEATURE_NAME>> |
NetFx3 |
Windows feature name |
<<CAPABILITY_NAME>> |
OpenSSH.Client~~~~0.0.1.0 |
Feature on Demand name (FoD) |
<<WIM_PATH>> |
D:\sources\install.wim |
WIM/ESD image file |
<<INDEX>> |
1 |
Image index |
<<MOUNT_DIR>> |
C:\mount |
Mount point |
<<DRIVER_DIR>> |
D:\drivers |
Folder containing driver INF files |
<<PACKAGE_PATH>> |
C:\Updates\kb5005565.cab |
Update package file |
<<LANG_PACK>> |
C:\LP\ja-jp\lp.cab |
Language pack CAB |
<<SOURCE_PATH>> |
D:\sources\sxs |
Source files (e.g., NetFx3) |
<<APPLY_DIR>> |
C:\ |
Apply/extract destination |
<<SCRATCH_DIR>> |
C:\Temp\Scratch |
Working directory |
<<LOG_PATH>> |
C:\Temp\dism.log |
Log path |
Most commands also accept
/ScratchDir:<<SCRATCH_DIR>>and/LogPath:<<LOG_PATH>>.
Step 1: Target Selection (/Online vs /Image)
Most DISM commands require an explicit target.
| Option | Meaning | Example |
|---|---|---|
/Online |
Current running Windows | dism /Online /Cleanup-Image /CheckHealth |
/Image:<<IMAGE_PATH>> |
Offline Windows or mounted image | dism /Image:C:\mount /Add-Driver /Driver:D:\drivers /Recurse |
Step 2: List Features (/Get-Features, /Get-FeatureInfo)
Summary
Enumerate available features and their state: Enabled / Disabled / DisabledWithPayloadRemoved.
Key Options
| Option | Meaning | Example |
|---|---|---|
/Online |
Target running OS | dism /Online /Get-Features |
/Image:<<IMAGE_PATH>> |
Target offline image | dism /Image:C:\mount /Get-Features |
/Get-Features |
List features | dism /Online /Get-Features /Format:Table |
/Get-FeatureInfo |
Detail for one feature | dism /Online /Get-FeatureInfo /FeatureName:NetFx3 |
/FeatureName:<<FEATURE_NAME>> |
Feature name | NetFx3 |
/Format:Table |
Tabular output | dism /Online /Get-Features /Format:Table |
Examples
# List all features and states
dism /Online /Get-Features /Format:Table
# Inspect a specific feature
dism /Online /Get-FeatureInfo /FeatureName:NetFx3
If state is
DisabledWithPayloadRemoved, binaries are removed; specify/Source.
Step 3: Enable/Disable Features (/Enable-Feature, /Disable-Feature)
Summary
Enable/disable features such as .NET Framework 3.5 or SMB 1.0.
Key Options
| Option | Meaning | Example |
|---|---|---|
/Online |
Target running OS | dism /Online /Enable-Feature /FeatureName:NetFx3 |
/FeatureName:<<FEATURE_NAME>> |
Feature to manage | NetFx3 |
/All |
Include dependencies | |
/Source:<<SOURCE_PATH>> |
Payload source when removed | dism /Online /Enable-Feature /FeatureName:NetFx3 /Source:D:\sources\sxs |
/LimitAccess |
Don’t use WU/WSUS | |
/Enable-Feature |
Enable | dism /Online /Enable-Feature /FeatureName:SMB1Protocol |
/Disable-Feature |
Disable | dism /Online /Disable-Feature /FeatureName:SMB1Protocol |
/LogPath:<<LOG_PATH>> |
Log output |
Examples
# Enable .NET Framework 3.5 from local media without Internet
dism /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:<<SOURCE_PATH>> /LogPath:<<LOG_PATH>>
# Disable SMB1 for hardening
dism /Online /Disable-Feature /FeatureName:SMB1Protocol /LogPath:<<LOG_PATH>>
Step 4: Inspect Capabilities (/Get-Capabilities, /Get-CapabilityInfo)
Summary
List and inspect FoD (Features on Demand) such as RSAT, OpenSSH.Client, Language.Basic.
Key Options
| Option | Meaning | Example |
|---|---|---|
/Online |
Running OS | dism /Online /Get-Capabilities |
/Image:<<IMAGE_PATH>> |
Offline image | dism /Image:C:\mount /Get-Capabilities |
/Get-Capabilities |
List FoD | dism /Online /Get-Capabilities /Format:Table |
/Get-CapabilityInfo |
Detail | dism /Online /Get-CapabilityInfo /CapabilityName:OpenSSH.Client~~~~0.0.1.0 |
/Format:Table |
Tabular output | dism /Online /Get-Capabilities /Format:Table |
Examples
# Enumerate FoD
dism /Online /Get-Capabilities /Format:Table
# Inspect one capability
dism /Online /Get-CapabilityInfo /CapabilityName:<<CAPABILITY_NAME>>
Capabilities can be sourced from Windows Update, WSUS, or FoD ISO/shares.
Step 5: Add/Remove Capabilities (/Add-Capability, /Remove-Capability)
Summary
Add/remove on-demand components like OpenSSH or RSAT tools.
Key Options
| Option | Meaning | Example |
|---|---|---|
/Online |
Running OS | dism /Online /Add-Capability |
/CapabilityName:<<CAPABILITY_NAME>> |
Capability to manage | OpenSSH.Client~~~~0.0.1.0 |
/Source:<<SOURCE_PATH>> |
FoD ISO or share | dism /Online /Add-Capability /CapabilityName:OpenSSH.Client~~~~0.0.1.0 /Source:D:\ /LimitAccess |
/LimitAccess |
Use only given source | |
/LogPath:<<LOG_PATH>> |
Log output |
Examples
# Add OpenSSH.Client (online, from network or ISO)
dism /Online /Add-Capability /CapabilityName:<<CAPABILITY_NAME>> /LogPath:<<LOG_PATH>>
# Remove an unneeded RSAT tool
dism /Online /Remove-Capability /CapabilityName:<<CAPABILITY_NAME>> /LogPath:<<LOG_PATH>>
Step 6: Image Repair & Component Store (/Cleanup-Image)
Summary
Detect/repair WinSxS corruption and optimize disk usage.
Key Options
| Option | Meaning | Example |
|---|---|---|
/Online |
Running OS | dism /Online /Cleanup-Image /CheckHealth |
/CheckHealth |
Quick check | |
/ScanHealth |
Deep scan | |
/RestoreHealth |
Repair | dism /Online /Cleanup-Image /RestoreHealth |
/Source:<<SOURCE_PATH>> |
Repair source | |
/LimitAccess |
Avoid WU | |
/StartComponentCleanup |
Remove superseded updates | |
/ResetBase |
Consolidate (no rollback) | |
/AnalyzeComponentStore |
Size analysis |
Examples
# Quick corruption check
dism /Online /Cleanup-Image /CheckHealth
# Deep scan
dism /Online /Cleanup-Image /ScanHealth
# Repair with local source
dism /Online /Cleanup-Image /RestoreHealth /Source:<<SOURCE_PATH>> /LimitAccess /LogPath:<<LOG_PATH>>
# Cleanup and consolidate updates
dism /Online /Cleanup-Image /StartComponentCleanup /ResetBase /LogPath:<<LOG_PATH>>
Step 7: Image Info (/Get-ImageInfo)
Key Options
| Option | Meaning | Example |
|---|---|---|
/Get-ImageInfo |
Show images inside WIM/ESD | dism /Get-ImageInfo /ImageFile:install.wim |
/ImageFile:<<WIM_PATH>> |
WIM to inspect | |
/Index:<<INDEX>> |
Target index | |
/LogPath:<<LOG_PATH>> |
Log output |
Example
# Show editions and indexes in install.wim
dism /Get-ImageInfo /ImageFile:<<WIM_PATH>> /LogPath:<<LOG_PATH>>
Step 8: Mount & Unmount Offline Images
Key Options
| Option | Meaning | Example |
|---|---|---|
/Mount-Wim |
Mount WIM | |
/WimFile:<<WIM_PATH>> |
Source WIM | |
/Index:<<INDEX>> |
Index to mount | |
/MountDir:<<MOUNT_DIR>> |
Mount directory | |
/ReadOnly |
Read-only mount | |
/Get-MountedWimInfo |
Show mount status | |
/Unmount-Wim |
Unmount | |
/Commit |
Save changes | |
/Discard |
Discard changes |
Examples
# Mount for editing
dism /Mount-Wim /WimFile:<<WIM_PATH>> /Index:<<INDEX>> /MountDir:<<MOUNT_DIR>>
# Check current mounts
dism /Get-MountedWimInfo
# Save and unmount
dism /Unmount-Wim /MountDir:<<MOUNT_DIR>> /Commit
Step 9: Integrate Drivers, Packages, and Language Packs
Key Options
| Option | Meaning | Example |
|---|---|---|
/Online |
Running OS | |
/Image:<<MOUNT_DIR>> |
Offline image target | |
/Add-Driver |
Add drivers | |
/Driver:<<DRIVER_DIR>> |
Folder containing INF | |
/Recurse |
Include subfolders | |
/Add-Package |
Add updates or language packs | |
/PackagePath:<<PACKAGE_PATH>> |
Package path | |
/Set-AllIntl:ja-JP |
Set locale to Japanese |
Notes:
/Add-Driveris offline only./Add-Packageand/Set-AllIntlwork online or offline.
Examples
# Integrate drivers
dism /Image:<<MOUNT_DIR>> /Add-Driver /Driver:<<DRIVER_DIR>> /Recurse
# Integrate an update
dism /Image:<<MOUNT_DIR>> /Add-Package /PackagePath:<<PACKAGE_PATH>>
# Add a language pack and set locale
dism /Image:<<MOUNT_DIR>> /Add-Package /PackagePath:<<LANG_PACK>>
dism /Image:<<MOUNT_DIR>> /Set-AllIntl:ja-JP
Step 10: Capture, Export, and Apply Images
Key Options
| Option | Meaning | Example |
|---|---|---|
/Capture-Image |
Capture a folder to WIM | |
/ImageFile:<<WIM_PATH>> |
Output WIM | |
/CaptureDir:<<APPLY_DIR>> |
Source directory | |
/Name:"<name>" |
Image name | |
/Export-Image |
Export/compress existing WIM | |
/Apply-Image |
Apply WIM | |
/Compress:max |
Max compression | |
/ApplyDir:<<APPLY_DIR>> |
Destination directory |
Examples
# Capture current layout to WIM
dism /Capture-Image /ImageFile:D:\Custom.wim /CaptureDir:<<APPLY_DIR>> /Name:"Custom Image"
# Export with maximum compression
dism /Export-Image /SourceImageFile:<<WIM_PATH>> /SourceIndex:<<INDEX>> /DestinationImageFile:D:\install_compressed.wim /Compress:max
# Apply an image
dism /Apply-Image /ImageFile:<<WIM_PATH>> /Index:<<INDEX>> /ApplyDir:<<APPLY_DIR>>
Step 11: PowerShell Equivalents
Mapping Table
| Area | DISM Command | PowerShell Cmdlet | Purpose |
|---|---|---|---|
| Features (list/detail) | /Get-Features, /Get-FeatureInfo |
Get-WindowsOptionalFeature |
Inventory & details |
| Enable/Disable features | /Enable-Feature, /Disable-Feature |
Enable-WindowsOptionalFeature, Disable-WindowsOptionalFeature |
Toggle features |
| Capabilities (list/detail) | /Get-Capabilities, /Get-CapabilityInfo |
Get-WindowsCapability |
Inventory & details |
| Add/Remove capabilities | /Add-Capability, /Remove-Capability |
Add-WindowsCapability, Remove-WindowsCapability |
FoD management |
| Packages (info/add) | /Get-Packages, /Add-Package |
Get-WindowsPackage, Add-WindowsPackage |
Updates & LPs |
| Drivers (info/add/remove) | /Get-Drivers, /Add-Driver, /Remove-Driver |
Get-WindowsDriver, Add-WindowsDriver, Remove-WindowsDriver |
Primarily offline |
| Image info/mount | /Get-ImageInfo, /Mount-Wim, /Unmount-Wim |
Get-WindowsImage, Mount-WindowsImage, Dismount-WindowsImage |
WIM management |
11.1 Features
Get-WindowsOptionalFeature
| Option | Meaning | Example |
|---|---|---|
-Online |
Running OS | Get-WindowsOptionalFeature -Online -FeatureName <<FEATURE_NAME>> |
-Path <<IMAGE_PATH>> |
Offline image | Get-WindowsOptionalFeature -Path <<IMAGE_PATH>> |
-FeatureName <<FEATURE_NAME>> |
Specific feature | -FeatureName NetFx3 |
# List all (online)
Get-WindowsOptionalFeature -Online
# Detail (offline)
Get-WindowsOptionalFeature -Path <<IMAGE_PATH>> -FeatureName <<FEATURE_NAME>>
Enable-/Disable-WindowsOptionalFeature
| Option | Meaning | Example |
|---|---|---|
-Online / -Path <<IMAGE_PATH>> |
Target | Enable-WindowsOptionalFeature -Online |
-FeatureName <<FEATURE_NAME>> |
Feature name | -FeatureName NetFx3 |
-All |
Include dependencies | -All |
-Source <<SOURCE_PATH>> |
Payload source | -Source <<SOURCE_PATH>> |
# Enable NetFx3 with local source
Enable-WindowsOptionalFeature -Online -FeatureName NetFx3 -All -Source <<SOURCE_PATH>>
# Disable SMB1
Disable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol
11.2 Capabilities
Get-WindowsCapability
| Option | Meaning | Example |
|---|---|---|
-Online |
Running OS | Get-WindowsCapability -Online |
-Name <<CAPABILITY_NAME>> |
Supports wildcard | Get-WindowsCapability -Online -Name OpenSSH.* |
-Path <<IMAGE_PATH>> |
Offline target | Get-WindowsCapability -Path <<IMAGE_PATH>> |
# List (online)
Get-WindowsCapability -Online
# Filter single capability
Get-WindowsCapability -Online -Name <<CAPABILITY_NAME>>
Add-/Remove-WindowsCapability
| Option | Meaning | Example |
|---|---|---|
-Online / -Path <<IMAGE_PATH>> |
Target | Add-WindowsCapability -Online |
-Name <<CAPABILITY_NAME>> |
Capability name | -Name OpenSSH.Client~~~~0.0.1.0 |
-Source <<SOURCE_PATH>> |
FoD source | -Source <<SOURCE_PATH>> |
# Add (online, with source if required)
Add-WindowsCapability -Online -Name <<CAPABILITY_NAME>>
# Remove
Remove-WindowsCapability -Online -Name <<CAPABILITY_NAME>>
11.3 Packages (updates & language packs)
Get-WindowsPackage
| Option | Meaning | Example |
|---|---|---|
-Online / -Path <<IMAGE_PATH>> |
Target | Get-WindowsPackage -Online |
-PackagePath <<PACKAGE_PATH>> |
Info for a package | Get-WindowsPackage -Online -PackagePath <<PACKAGE_PATH>> |
# List installed packages
Get-WindowsPackage -Online
Add-WindowsPackage
| Option | Meaning | Example |
|---|---|---|
-Online / -Path <<IMAGE_PATH>> |
Target | Add-WindowsPackage -Online -PackagePath <<PACKAGE_PATH>> |
-PackagePath <<PACKAGE_PATH>> |
.cab (preferred) / .msu |
# Add an update (online)
Add-WindowsPackage -Online -PackagePath <<PACKAGE_PATH>>
# Add a language pack (offline)
Add-WindowsPackage -Path <<IMAGE_PATH>> -PackagePath <<LANG_PACK>>
11.4 Drivers
Get-WindowsDriver
| Option | Meaning | Example |
|---|---|---|
-Online / -Path <<IMAGE_PATH>> |
Target | Get-WindowsDriver -Path <<IMAGE_PATH>> |
-All |
Show all drivers | -All |
# List drivers in an offline image
Get-WindowsDriver -Path <<IMAGE_PATH>> -All
Add-/Remove-WindowsDriver
| Option | Meaning | Example |
|---|---|---|
-Path <<IMAGE_PATH>> |
Target image | Add-WindowsDriver -Path <<IMAGE_PATH>> -Driver <<DRIVER_DIR>> -Recurse |
-Driver <<DRIVER_DIR>> |
INF folder | |
-Recurse |
Include subfolders | |
-Driver <<oem*.inf>> (Remove) |
INF to remove | Remove-WindowsDriver -Path <<IMAGE_PATH>> -Driver oem1.inf |
# Add drivers (offline)
Add-WindowsDriver -Path <<IMAGE_PATH>> -Driver <<DRIVER_DIR>> -Recurse
# Remove a driver (offline)
Remove-WindowsDriver -Path <<IMAGE_PATH>> -Driver oem1.inf
Important:
Add-/Remove-WindowsDriverdo not support-Online; use them against offline images.
11.5 Image Info & Mount
Get-WindowsImage
| Option | Meaning | Example |
|---|---|---|
-ImagePath <<WIM_PATH>> |
WIM/ESD path | Get-WindowsImage -ImagePath <<WIM_PATH>> |
-Index <<INDEX>> |
Specific index only | -Index <<INDEX>> |
# Show all indexes of install.wim
Get-WindowsImage -ImagePath <<WIM_PATH>>
Mount-/Dismount-WindowsImage
| Option | Meaning |
|---|---|
-ImagePath <<WIM_PATH>> |
Source WIM |
-Index <<INDEX>> |
Index to mount |
-Path <<MOUNT_DIR>> |
Mount directory |
-ReadOnly |
Read-only mount |
-ScratchDirectory <<SCRATCH_DIR>> |
Working dir |
-Save (Dismount) |
Save changes |
-Discard (Dismount) |
Discard changes |
# Mount
Mount-WindowsImage -ImagePath <<WIM_PATH>> -Index <<INDEX>> -Path <<MOUNT_DIR>>
# Save and dismount
Dismount-WindowsImage -Path <<MOUNT_DIR>> -Save
Summary
- DISM: low-level management of OS components, WIM, updates, and drivers.
- PowerShell (DISM API): same scope with scriptability for inventory, selection, and automation.
- Capabilities (FoD): on-demand features (OpenSSH, RSAT, language packs).
