The article here addresses the issue how to get rid of a specific KB (Update) and shows some more DISM commands to fix broken Windows online images. With a few tricks in the Windows Deployment Image Servicing and Management command utility, admins can solve some of the most common Windows 10 update problems plaguing their users.
DISM is really powerful and is well documented in the official Microsoft docs, which you can find right here. There is an unofficial GUI utility for it in case you’re not really a friend of the command line which is called DISM++ developed by a Chinese guy since several years but it’s not really needed because the command line parameters are very easy to understand and as already mentioned, well documented,
Identify the installed cumulative updates (KB)
First, we need to find the list of packages installed on the PC with the issue by performing this command
- dism /online /get-packages /format:table
Alternative you can use this to get a better view
- dism /online /get-packages /format:table > patches.txt
This will generate a list called ‘patches.txt’ were you can see all installed updates or hotfixes.
Remove the problematically KB
Let’s say you want to remove the Package_for_KB2870699~31bf3856ad364e35~amd64~~6.2.1.1 package, then use the following command to silently remove it:
- DISM.exe /Online /Remove-Package /PackageName:Package_for_KB2870699~31bf3856ad364e35~amd64~~6.2.1.1 /quiet /norestart
You could use this command in a batch script in case you want to remove more than one update, the hardest process is to find the exact name but with the given method you just need to look at KB number to identify which package you need to remove. If you want to get rid of a hotfix this is a little bit more complicated because there is no specific identification given and the names are random, so before you install a hotfix, ensure you make a list of the currently installed updates and compare it against the list after you installed the hotfix.
Other useful commands
Displays a basic Help and stores it into a file
- dism /? dism /mount-wim /? >C:\dismhelp.txt
Display a list of all the Windows images contained:
- dism /get-wiminfo /wimfile:
Mount an Windows image:
- dism /mount-wim /wimfile: /index:1 /mountdir:c:\mount
Image status/cleanup:
- dism /get-mountedwiminfo if okay remount the image dism /remount-wim /mountdir: dism /cleanup-wim
Add all drivers from a folder:
- dism /image:c:\mount /add-driver /driver:c:\drivers
Add all drivers from top-level folders and all folders below:
- dism /image:c:\mount /add-driver /driver:c\drivers /recurse
Add specific driver:
- dism /image:c:\mount /add-driver /driver:c:\drivers\mydriver.inf
Add unsigned driver:
- dism /image:c:\mount /add-driver /driver:c:\drivers\mydriver.inf /forceunsigned
List of all drivers:
- dism /image:c:\mount /get-drivers dism /image:c:\mount /get-drivers /format:table
Get a specific driver info:
- dism /image:c:\mount /get-driverinfo /driver:c:\drivers\usb\usb.inf
Remove a driver:
- dism /image:c:\mount /remove-driver /driver:oem1.inf
Remove multiple drivers:
- dism /image:c:\mount /remove-driver /driver:oem1.inf /driver:oem2.inf
For large drivers (eg nVidia)
- dism /image:c:\mount /add-driver /driver:c:\drivers\nvidia /forceunsigned /scratchdir:c:\temp dism /image:c:\mount /add-driver /driver:c:\drivers\ /recurse /scratchdir:c:\temp
Add specific Packages:
- dism /get-wiminfo /wimfile: dism /mount-wim /wimfile: /name:”Windows 7 HomeBasic” /mountdir:c:\mount dism /image:c:\mount /add-package /packagepath:c:\packages\package1.cab /packagepath:c:\packages\package2.cab dism /unmount-wim /mountdir:c:\mount /commit
Add an MSU update (replace the XXXXX with your KB number of the update you like to install)
- dism /image:c:\mount /add-package /packagepath:c:\updates\xxxxx.msu
Add all updates from a folder:
- dism /image:c:\mount /add-package /packagepath:c:\updates
Manage Windows features:
- dism /online /get-features | more dism /online /enable-feature /featurename: dism /online /disable-feature /featurename:<add-you-feature-you'll-like-to-remove-here>
Fix SFC problems and scan your image for problems:
DISM /Online /Cleanup-Image /RestoreHealth
There are a lot of more useful command lines which you could use but I think these are the most used ones which help to fix or modify your image.