Share via

Why does Dism.exe /online /Cleanup-Image /StartComponentCleanup result in Error 5 Access denied

Anonymous
2025-01-15T14:55:23+00:00

Can someone tell me why, when running Running Administrator Command Prompt, I get

Error: 5

Access is denied (at the end) :

Microsoft Windows [Version 10.0.19045.5371]

(c) Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>sfc /scannow

Beginning system scan.  This process will take some time.

Beginning verification phase of system scan.

Verification 100% complete.

Windows Resource Protection did not find any integrity violations.

C:\WINDOWS\system32>DISM /Online /Cleanup-Image /RestoreHealth

Deployment Image Servicing and Management tool

Version: 10.0.19041.3636

Image Version: 10.0.19045.5371

[==========================100.0%==========================] The restore operation completed successfully.

The operation completed successfully.

C:\WINDOWS\system32>Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore

Deployment Image Servicing and Management tool

Version: 10.0.19041.3636

Image Version: 10.0.19045.5371

[==========================100.0%==========================]

Component Store (WinSxS) information:

Windows Explorer Reported Size of Component Store : 12.16 GB

Actual Size of Component Store : 11.95 GB

    Shared with Windows : 5.26 GB

    Backups and Disabled Features : 6.46 GB

    Cache and Temporary Data : 224.61 MB

Date of Last Cleanup : 2021-03-21 21:00:43

Number of Reclaimable Packages : 2

Component Store Cleanup Recommended : Yes

The operation completed successfully.

C:\WINDOWS\system32>Dism.exe /online /Cleanup-Image /StartComponentCleanup

Deployment Image Servicing and Management tool

Version: 10.0.19041.3636

Image Version: 10.0.19045.5371

[=====                      10.0%                          ]

[========================== 46.2%                          ]

Error: 5

Access is denied.

The DISM log file can be found at C:\WINDOWS\Logs\DISM\dism.log

Windows for home | Windows 10 | Files, folders, and storage

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

8 answers

Sort by: Most helpful
  1. Ramesh 176.3K Reputation points Volunteer Moderator
    2025-01-28T04:16:54+00:00

    Hi Mike,

    Dism.log is not very useful in this case. The CBS logs will provide more information about the error. Or, even better, run a ProcMon trace as mentioned earlier.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2025-01-25T15:19:46+00:00

    Hi Ramesh, thank you for your reply.

    Sorry about the delay.

    Your mention of the log files, led me to look again at the Dism.log file, that was generated when I last ran it (see above).

    Towards the end of the log, a series of lines stood out:

    "                        

    2025-01-19 17:45:58, Info                         pszWellKnownDirs:Windows\Panther

    2025-01-19 17:45:58, Info                         bCleanWindowsOld:0

    2025-01-19 17:45:58, Info                         bRemoveUninstall:0

    2025-01-19 17:45:58, Info                         bShowOnlyInUpgrade:1

    2025-01-19 17:45:58, Info                         bShowOnlyInESDInstall:0

    2025-01-19 17:45:58, Info                         bSilentCleanup:1

    2025-01-19 17:45:58, Info                         bCleanupTemporaryInstallationFiles:0

    2025-01-19 17:45:58, Info                         CSetupFilesCleanup::GetSpaceUsed - Calculating the space for session: Windows Upgrade Log Files

    2025-01-19 17:45:58, Info                         IsProcessElevated - bResult: 1

    2025-01-19 17:45:58, Info                         CSetupFilesCleanup::CleanVolume - Iterating on: C:\Windows\Panther

    2025-01-19 17:45:58, Info                         CSetupFilesCleanup::CleanVolume - Return status: 0

    2025-01-19 17:45:58, Info                         CSetupFilesCleanup::GetSpaceUsed - Space used : 0

    2025-01-19 17:45:58, Info                         CSetupFilesCleanup::GetSpaceUsed - Block status: 0

    2025-01-19 17:45:58, Info                         CSetupFilesCleanup::Initialize - Not allowed to delete : Windows Upgrade Log Files

    2025-01-19 17:45:58, Info                         Initialization status:1"

    This appears to be why it is failing?

    I have got to the stage where I am not going to pursue this, as I am having to change my laptop for a Windows 11 version (my current laptop is not suitable for upgrading from Windows 10, due to its age), Windows 10 support ceasing in October this year.

    Thank you again for your interest.

    Regards.

    Mike.

    Was this answer helpful?

    0 comments No comments
  3. Ramesh 176.3K Reputation points Volunteer Moderator
    2025-01-19T17:29:58+00:00

    Hi there,

    We may be able to narrow down the issue by running a ProcMon trace. Please run a ProcMon trace and share the zipped log on OneDrive.

    Note: The Process Monitor log file can reveal your user account name or sometimes the Microsoft account email ID. If you wish to share the log with me or specific people, you can share it using the "Restricted" option in Google Drive. You can grant me access once I send a request.

    1. Download Process Monitor from Microsoft: http://live.sysinternals.com/procmon.exe
    2. Launch Process Monitor.
    3. Reset the filter options and click OK.
    4. If tracing does not start automatically, press Ctrl + E.
    5. Run "dism /online /cleanup-image /startcomponentcleanup" in the admin command prompt.
    6. When DISM generates an error, switch to Process Monitor and stop tracing (Ctrl + E).
    7. Save "All Events" in a PML log file.
    8. *Zip* the log file and upload it to your OneDrive.

    The PML log size will be huge. Zipping it reduces the size by 90%.

    Was this answer helpful?

    0 comments No comments