cleanupimage
Cleanup-image is a subcommand of the Deployment Image Servicing and Management (DISM) tool used to service Windows images. It performs maintenance tasks on the Windows component store, helps reclaim disk space, and can prepare an image for servicing. The command operates on either the currently running online system or an offline, mounted Windows image.
- Online: perform tasks on the live operating system using DISM with the /online switch.
- Offline: service a mounted image by specifying /image:<path>.
- Typical tasks include analyzing the component store, cleaning superseded components, and adjusting the base version.
- /AnalyzeComponentStore analyzes the Windows component store (WinSxS) to report its size and composition.
- /StartComponentCleanup cleans up superseded components in the component store to reclaim space.
- /ResetBase, when used with /StartComponentCleanup, reduces the ability to roll back to previous service states by
- /SPSuperseded is used in some versions to remove superseded service-pack components.
- /RestoreHealth can be used to repair a corrupted image, and /AuditMounts is related in offline scenarios.
- Clean up the running system: dism /online /cleanup-image /startcomponentcleanup
- Analyze the component store: dism /online /cleanup-image /analyzecomponentstore
- Repair the image: dism /online /cleanup-image /restorehealth
- Offline cleanup on a mounted image: dism /image:C:\mount /cleanup-image /startcomponentcleanup
- Administrative privileges are required to run cleanup-image commands.
- Operations may take time and can require a reboot to complete changes.
- Results depend on OS version and image state; not all options apply to every release.