Dism Online Cleanup Image Restorehealth – Best Guide in 2023

 Dism Online Cleanup Image Restorehealth

Dism is a powerful command-line tool in Windows that allows you to service Windows images. It can be used to cleanup, configure, and prepare a Windows image before deployment. Dism provides capabilities like removing built-in apps, enabling or disabling Windows features, and reducing the size of image.

Using Dism online cleanup image and restorehealth options allow you to fix corruption issues, remove unwanted files or features and prepare a clean base image for re-deployment. This greatly improves the reliability and performance of Windows images.

 What is Dism?

Dism (Deployment Image Servicing and Management) is a command-line utility built into Windows that provides servicing capabilities for Windows images.

Some key capabilities Dism provides:

  • Mount and service Windows images offline
  • Add, remove, and configure features and packages
  • Reduce the size of image
  • Cleanup and fix corruption issues
  • Prepare and optimize images for deployment

Dism exposes the imaging capabilities in Windows, like dismounting, mounting and committing changes to images. It works at lower level than other tools, directly servicing the Windows image file system.

 Why Use Dism for Image Cleanup and Restorehealth?

Using Dism for regular online image cleanup and restorehealth provides several benefits:

 Remove Unwanted Components

Dism allows you to cleanly remove built-in apps, features or packages that you don’t want in your default image. Removing unwanted components reduces image size.

 Fix Corruption Issues

The restorehealth option fixes registry and component store corruption in Windows images. This greatly improves reliability of the image.

 Optimize Image

Servicing the image with Dism allows optimizing the image by removing unnecessary files, temporary data and older Windows versions. This reduces the image size for faster deployment.

 Prepare Clean Base Image

Using Dism you can prepare a clean, lean and reliable base image that serves as golden image for re-deployment.

 Improve Performance

Cleanup and optimization with Dism improves performance – faster boot time, quicker installations and better runtime performance.

 Recover Broken Image

Dism provides last resort option to fix badly broken image corruption and recover the image instead of fully re-installing Windows.

 How to Use Dism for Online Cleanup

Here are the typical steps to use Dism for online cleanup of mounted Windows image:

 Mount Windows Image

First, mount the Windows image file (.wim, .vhd, .vhdx) which exposes it as a local drive that can be serviced:

Dism /Mount-Image /ImageFile:C:\images\install.wim /index:1 /MountDir:C:\test\offline

This mounts install.wim image to C:\test\offline folder.

 

 Open Command Prompt

Launch Command Prompt as Administrator to run Dism commands.

 Cleanup Image

Use below command to cleanup and optimize the mounted image:

Dism /Image:C:\test\offline /Cleanup-Image /StartComponentCleanup /ResetBase

This cleans up components store corruption, removes temporary files, disables widgets, clears CBS logs etc.

 

Remove Unwanted Apps/Features

Below command removes unwanted built-in AppX packages like Candy Crush, mixed reality portal etc:

Dism /Image:C:\test\offline /Remove-ProvisionedAppxPackage /PackageName:Microsoft.BingWeather_8wekyb3d8bbwe

You can run multiple cleanup and removal commands based on your requirements.

 

 Commit Changes

Once cleanup is done, commit changes back to image file:

Dism /Unmount-Image /MountDir:C:\test\offline /Commit

This commits back changes to original install.wim image file.

The serviced image is now cleaned, optimized and ready for deployment.

 

 How to Use Dism RestoreHealth

The /RestoreHealth option fixes corruption issues in Windows image registry, component store and Windows Update databases.

Below are the steps to use it

 Mount Image

Mount the Windows Image file (.wim, .vhd) to a temporary folder:

Dism /Mount-Image /ImageFile:D:\install\install.wim /index:1 /MountDir:c:\offline

 

 Run RestoreHealth

Launch Command Prompt as Administrator and run:

Dism /Image:c:\offline /Cleanup-Image /RestoreHealth

This will scan the mounted image and fix identified corruption issues.

 

 Commit Changes

Once restorehealth operation completes, commit changes back:

Dism /Unmount-Image /MountDir:c:\offline /Commit

The image is now repaired and restored to healthy state.

 

 Dism Cleanup Image Options

Here are some useful options that can be used with /Cleanup-Image to optimize and reduce the size of the image:

/StartComponentCleanup – Cleans up component store corruption

/ResetBase – Resets the image to default base state

/SPSuperseded – Uninstalls superseded versions of Store apps

/SPRemove- All provisioned appx packages removed

/ScratchDir – Removes the scratch directory contents

/RecoverDrivers – Removes older Plug and Play device drivers

 Dism RestoreHealth Scan Options

The /RestoreHealth operation scans and fixes corruption issues across various Windows image components.

Useful scan options:

 

/Source – Scan Windows Update integrity databases

/AutoScan – Scans all critical component stores

/ScanInboxDrivers – Verify inbox drivers are registered correctly

/UserData – Scan user profile registry hives

/LimitAccess – Reset file/registry permissions

This allows selectively running targeted scan and repair based on corruption symptoms.

 

 Dism Remove Provisioned Apps

You can selectively remove unwanted built-in modern apps from the image using:

Dism /Image:C:\test\offline /Remove-ProvisionedAppxPackage /PackageName:Microsoft.BingWeather

Some common AppX package names to remove:

  • 3DBuilder
  • BingFinance
  • BingNews
  • BingSports
  • BingWeather
  • CommsPhone
  • Getstarted
  • MicrosoftOfficeHub
  • MicrosoftSolitaireCollection
  • MicrosoftStickyNotes
  • Office.OneNote
  • OneConnect
  • People
  • SkypeApp
  • Windows.Photos
  • WindowsAlarms
  • WindowsCamera
  • WindowsCommunicationsApps
  • WindowsFeedbackHub
  • WindowsMaps
  • WindowsPhone
  • WindowsSoundRecorder
  • XboxApp
  • ZuneMusic
  • ZuneVideo

 Dism Remove Windows Features

Unwanted in-box Windows features can also be removed from the image, like below:

Dism /Image:C:\test\offline /Remove-Feature /FeatureName:Printing-PrintToPDFServices-Features

Dism /Image:C:\test\offline /Remove-Feature /FeatureName:WorkFolders-Client 

Use dism /Online /Get-Features to get full list of features names.

 

 Dism Cleanup Script Example

Here is a sample PowerShell script to perform multi-step Dism cleanup on mounted Windows image:

 Mount install.wim image

Dism /Mount-Image /ImageFile:C:\install.wim /Index:1 /MountDir:C:\offline

 

 Cleanup image

Dism /Image:C:\offline /Cleanup-Image /StartComponentCleanup

 

 Remove all provisioned Appx packages

Dism /Image:C:\offline /Remove-ProvisionedAppxPackage /All

 

Remove unwanted features

Dism /Image:C:\offline /Remove-Feature /FeatureName:Internet-Explorer-Optional-amd64

 

 Optimize image

Dism /Image:C:\offline /ScratchDir /RecoverDrivers

 

 Commit changes and unmount

Dism /Unmount-Image /MountDir:C:\offline /Commit

 

This automates the entire servicing process for preparing clean images.

 

 Dism RestoreHealth Script Example

Below PowerShell script automates Dism restorehealth to scan and fix a corrupted image:

 

 Mount Windows image

Dism /Mount-Image /ImageFile:C:\images\install.wim /Index:1 /MountDir:C:\windows

 

 Run restorehealth scan

Dism /Image:C:\windows /Cleanup-Image /RestoreHealth

 

 Additional scans

Dism /Image:C:\windows /Cleanup-Image /RestoreHealth /Source /LimitAccess

 

 Commit changes

Dism /Unmount-Image /MountDir:C:\windows /Commit

This detects and repairs any component store corruption issues in the image.

 

ALSO READ: How to Unblur Course Hero Documents for Free

 

 Dism Tips and Best Practices

Follow these tips to use Dism effectively for image servicing:

  • Always mount Windows image files (.wim, .vhd, .vhdx) before servicing
  • Use separate scratch directory for temporary data
  • Test cleanup on copy of image first before modifying original
  • Automate cleanup steps in scripts to ensure consistency
  • Schedule periodic cleanup tasks using task scheduler
  • Check CBS and DISM logs for any errors after servicing
  • Validate image stability before re-deployment
  • Commit changes back to image file once done

Carefully using Dism can greatly improve image quality and minimize issues.

 Common Dism Issues and Fixes

Here are some common issues faced while using Dism and their fixes:

  • Dism is unable to access image file – Enable LockedAdmin permission on image file
  • Mounted image is empty – Specify correct edition / index of image
  • Cleanup takes too long – Use solid state drive, increase scratch space
  • Corruption still exists – Run multiple scan passes, reboot and retry
  • Changes not reflected in image – Don’t forget to commit changes
  • Image fails to boot – Ensure only unwanted components removed

Carefully reviewing logs, double checking commands used and testing single steps at a time helps resolve Dism issues.

 Frequently Asked Questions

 What are the key benefits of using Dism cleanup and restorehealth?

Dism cleanup and restorehealth allows you to optimize, reduce size and fix corruption issues in Windows images. This improves the performance, stability and reliability of the images.

 When should you run Dism cleanup on Windows image?

Dism cleanup should be run periodically on any customized image to keep it lean. It should also be used on any image showing stability issues or problems during deployment.

 Does Dism work on Windows Server and Desktop OS images?

Yes, Dism can be used to service images for Windows 10, Windows 11 as well as Windows Server versions.

 Is Dism better than the DISM GUI?

Dism provides more options compared to DISM GUI. Dism is preferred as it allows automating image servicing steps through scripts.

 Can you remove built-in apps like Edge browser using Dism?

Yes, Dism can remove any provisioned app including Microsoft Edge. Useful for custom images not requiring certain apps.

 Conclusion

Dism is a very powerful command line tool that allows deep servicing of Windows images. Using Dism cleanup and restorehealth operations periodically allows you to maintain clean, optimized and reliable image deployments.

Automating cleanup steps through scripts improves efficiency of image management. Dism gives you granular control over the image content.

Carefully using Dism as part of the deployment process greatly improves the quality of Windows images and reduces post-deployment issues.

 

Leave a Comment