How to fix Error Code 5 when trying to capture a reference image.

DE*CORAZON 0 Reputation points
2024-07-07T00:58:44.8+00:00

I am trying to capture a reference I created in a VM. This is the command I am putting in using WinPE. dism /capture-image /imagefile:"D:\WIN11.wim" /capturedir:D:\ /name:WIN11FULL /compress:max. I press enter.

Deployment Image Servicing and Management tool Version 10.0.22321.1

I get Error: 5 Access denied.

Has anyone run into this issue? Please assist. I am stuck right now.

Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
9,601 questions
{count} votes

2 answers

Sort by: Most helpful
  1. mikelydick 76 Reputation points
    2024-07-07T01:09:37.15+00:00

    Based on the information provided, it seems you are encountering an "Access denied" error (Error 5) when trying to capture a Windows image using DISM in WinPE. This is a common issue that can occur for a few reasons:

    1. Insufficient permissions: Make sure you are running the command prompt as an administrator.
    2. Drive letter mismatch: In WinPE, drive letters may be assigned differently than in the regular Windows environment. Use the diskpart utility to verify the correct drive letters:
    diskpart
    list volume
    

    This will show you the correct drive letters to use in your DISM command.

    1. Read-only attributes: The target drive or files may have read-only attributes set. Try removing these attributes:
    attrib -r D:\*.* /s /d
    
    1. Antivirus interference: If you have antivirus software running, it may be blocking DISM operations. Try temporarily disabling it.
    2. File system corruption: Run a chkdsk on the drive to ensure there are no file system issues:
    chkdsk D: /f
    
    1. Incorrect WinPE version: Ensure you're using a compatible version of WinPE for the Windows version you're trying to capture.

    To resolve this issue, try the following steps:

    1. Verify the correct drive letters using diskpart.
    2. Run the command prompt as administrator.
    3. Remove read-only attributes from the target drive.
    4. Ensure there are no file system issues by running chkdsk.
    5. Double-check that you're using a compatible WinPE version.

    If the issue persists, you may need to try capturing the image from a different environment or use alternative imaging tools like Microsoft Deployment Toolkit (MDT) or System Center Configuration Manager (SCCM).

    Share

    RewriteBased on the information provided, it seems you are encountering an "Access denied" error (Error 5) when trying to capture a Windows image using DISM in WinPE. This is a common issue that can occur for a few reasons:

    1. Insufficient permissions: Make sure you are running the command prompt as an administrator.
    2. Drive letter mismatch: In WinPE, drive letters may be assigned differently than in the regular Windows environment. Use the diskpart utility to verify the correct drive letters:
    diskpart
    list volume
    

    This will show you the correct drive letters to use in your DISM command.

    1. Read-only attributes: The target drive or files may have read-only attributes set. Try removing these attributes:
    attrib -r D:\*.* /s /d
    
    1. Antivirus interference: If you have antivirus software running, it may be blocking DISM operations. Try temporarily disabling it.
    2. File system corruption: Run a chkdsk on the drive to ensure there are no file system issues:
    chkdsk D: /f
    
    1. Incorrect WinPE version: Ensure you're using a compatible version of WinPE for the Windows version you're trying to capture.

    To resolve this issue, try the following steps:

    1. Verify the correct drive letters using diskpart.
    2. Run the command prompt as administrator.
    3. Remove read-only attributes from the target drive.
    4. Ensure there are no file system issues by running chkdsk.
    5. Double-check that you're using a compatible WinPE version.

    If the issue persists, you may need to try capturing the image from a different environment or use alternative imaging tools like Microsoft Deployment Toolkit (MDT) or System Center Configuration Manager (SCCM).

    https://video2.skills-academy.com/en-us/windows-hardware/manufacture/desktop/dism-image-management-command-line-options-s14?view=windows-11

    https://www.tenforums.com/general-support/173316-winpe-apply-image-access-denied-error-5-a.html

    0 comments No comments

  2. Hania Lian 15,171 Reputation points Microsoft Vendor
    2024-07-08T02:06:09.59+00:00

    Hello,

    The error message "Error: 5 Access denied" typically indicates that the DISM tool doesn't have sufficient permissions to access the files or directories you're trying to use. Here are several steps you can take to troubleshoot and potentially resolve the issue:

    Run WinPE with Administrator Privileges: Ensure that you are running the Windows Preinstallation Environment (WinPE) with administrative privileges. If you're not already, try restarting WinPE as an administrator.

    Check File System Permissions: Verify the permissions on the directory where you are attempting to capture the image (). You might need to adjust the permissions to allow the system or your user account full control over the directory.

    Disable Antivirus: Temporarily disable your antivirus software. Sometimes security software can interfere with system commands.

    Good Internet Connection: Ensure that you have a stable internet connection. Some DISM operations require downloading files from Microsoft servers.

    Try running the DISM command in Safe Mode with Networking:

    • Press Windows key and type: msconfig and press Enter;
    • Click on the System Boot tab and check the options: Secure boot and network;
    • Restart the pc.

    Hope this helps.

    Best Regards,

    Hania Lian

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.