Page 1 of 1

[SOLVED] Using dism with WUA

Published: February 18, 2026 - 4:23 PM
by Mikael S
Good morning,

You may have encountered a problem repairing a Windows image with DISM in online mode using WUA. WAPT is blocking the operation. The tool likely needs to use WSU.

Here is a small package that allows you to bypass the problem, provided you prepare an image with the correct version.
This also includes a rapid audit to warn of system corruption.

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *

def install():
    if force:
        if not isdir(r'c:\tmp'):
            mkdirs(r'c:\tmp')

        winver = windows_version(4)

        with open(r"c:\tmp\install.wim", "wb") as file:
            with WAPT.waptserver.get_requests_session(use_ssl_auth=True) as session:
                with session.get("%s/%s" % (WAPT.waptserver.server_url, f"wapt/scripts/dism/{winver}.wim"),
                            timeout=WAPT.waptserver.timeout,
                            auth=None,
                            allow_redirects=True,
                            stream=True) as response:
                    if response.status_code == 404:
                        error(f'Version {winver} non gérée, merci de prendre contact avec le mainteneur')
                    for chunk in response.iter_content(chunk_size=8192):
                        file.write(chunk)

        print(run('DISM /Online /Cleanup-image /Scanhealth', timeout=900))
        print(run(r'DISM /Online /Cleanup-image /Restorehealth /Source:wim:c:\tmp\install.wim:1 /LimitAccess', timeout=900))
        print(run('sfc /scannow', timeout=900))

        remove_file(r'c:\tmp\install.win')

def audit():
    dism = run('DISM /Online /Cleanup-image /CheckHealth')

    print(dism)

    if "réparable" in dism:
        return "WARNING"
    else:
        return("OK")
And the procedure

Retrieve the original install.wim file from an ISO image

Mount the ISO under Windows and then copy the file X:\Sources\install.wim
Then export only the Windows Pro version using the command

Dism /Export-Image /SourceImageFile:"C:\install.wim" /SourceIndex:6 /DestinationImageFile:"C:\origin.wim"

It is also possible to retrieve the previously generated WIM file so that updates take less time
To do this, simply copy the old wim file to origin.wim


Generate a cumulative image

If necessary, create the c:\mount folder

Upload image

Mount-WindowsImage -Path C:\mount -ImagePath c:\origin.wim -Index 1

Download the cumulative report on https://www.catalog.update.microsoft.co ... -framework
Only one of the two packages is needed, the larger one

Add the cumulative to the image

Add-WindowsPackage -path c:\mount -PackagePath C:\windows11.0-kbxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxx.msu

Save image

Dismount-WindowsImage -Path C:\mount -Save

Export the image, specifying the Windows version number, for example 10.0.26100.7623

DISM.exe /Export-Image /SourceImageFile:c:\origin.wim /DestinationImageFile:c:\number_version_windows.wim /SourceIndex:1

The origin.wim file must be regenerated before it can be used again

Copy the resulting file to the Wapt server in /var/www/wapt/scripts/dism
Remember to assign the rights to www-data

Re: Using dism with WUA

Published: February 18, 2026 - 5:53 PM
by sfonteneau
Mikael S wrote: Feb 18, 2026 - 4:23 PM WAPT is blocking the action. The tool probably needs to go through WSU.
No we do not pass not by wsus

However, we disable and re-enable the Windows Update service on demand. Perhaps the problem is simply that the Windows Update service is disabled

We use nothing more and nothing less than this: https://learn.microsoft.com/en-us/windo ... s=vbscript

Moreover, since Windows 11 24h2, installations are done using the dism command:

dism.exe /Online /Quiet /NoRestart /Add-Package /PackagePath:kb.msu

Re: Using dism with WUA

Published: March 3, 2026 - 10:15 AM
by Mikael S
Yes, if I temporarily activate the service, it works. My mistake. It's simpler this way

Re: Using dism with WUA

Published: March 16, 2026 - 10:11
by dcardon
Hi Mikaël,

thanks for the feedback :-) . I'm marking the topic as resolved.

Denis