Remove superseded updates in Windows 7

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).

Comments (0)

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.