Remove superseded updates in Windows 7

Published on
6,444 Points
1 Endorsement
Last Modified:
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space.

w60 means Windows Vista or Windows Server 2008.
w61 means Windows 7 or Windows Server 2008 R2.

There are various guides found on the internet on how-to integrate updates into Windows installation media using dism.
This article is a post-integrate how-to to this numerous articles.
This article is addressed to users, who are comfortable using dism to mount, update, manage and unmount Windows Image files for deployment of Windows Systems.
So mounting and dismounting images is intentionally left out.

Administrators often include windows update packages into their deployment images to save time when deploying.
In Windows 8 dism.exe has built-in command-line extensions to remove superseded updates from Windows 8 image files.
Earlier versions of Windows do not have this feature.
So when you integrate packages into a windows installation media (w60 or w61), superseded or outdated packages reside in the deployment image and use unneccessary space. This guide shows how to list and remove superseded packages from the command-line or by batch.

Short description for what you have to do before:
- Download Windows Updates for Windows (w60 or w61).
  Best practice is using wsus offline update.
- Mount Windows installation media.
- Apply packages to the mounted image.

The listings below offers two options.
The first option (offline) is adressed to manage superseded packages of an already mounted Windows (w60, w61) image.
The second option (online) is addressed to manage superseded packages on an online Windows (w60, w61) system.

Only tested for Win7:
Assuming image is mounted on c:\dism\mount or use online system.
Open elevated command prompt:

List superseded updates from command-line (Tip: Set command windows size > 150):

rem offline
dism /image:c:\dism\mount /get-packages /format:table /english | find /i "Superseded"

Open in new window

rem online
dism /online /get-packages /format:table /english | find /i "Superseded"

Open in new window

Write list of superseded updates to textfile:

dism /image:c:\dism\mount /get-packages /format:table /english | find /i "Superseded" > c:\packages.txt
notepad.exe c:\packages.txt

Open in new window

dism /online /get-packages /format:table /english | find /i "Superseded" > c:\packages.txt
notepad.exe c:\packages.txt

Open in new window

Remove all superseded updates:
Write "remove-superseded.cmd" with following code.
Please regard escape (^) before pipe (|) in batch.
@echo off
set mnt="c:\dism\mount"
for /f %%i in ('dism /image:%mnt% /get-packages /format:table /english ^| find /i "Superseded"') do (
echo %%i
dism /image:%mnt% /remove-package /packagename=%%i

Open in new window

@echo off
for /f %%i in ('dism /online /get-packages /format:table /english ^| find /i "Superseded"') do (
echo %%i
dism /online /remove-package /packagename=%%i

Open in new window

Open elevated command window and run "remove-superseded.cmd".
Now, since all superseded updates are removed, the deployment image will be smaller then before.

Short description for what you can do afterwards:
- Unmount image using dism. Don't forget to use the commit option.
- Compress image using imagex. (ADK or WAIK is needed).

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Join & Write a Comment

The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month