How can I delete documents/files from a install.wim?


  1. Posts : 154
    Dual boot Windows 10 Pro 22H2 (b 19045.4412) and Windows 11 Pro 23H2 (b 22631.3593)
       #1

    How can I delete documents/files from a install.wim?


    Hi everyone,

    I just made the mistake of capturing a(n old) Windows 10 installed image without first removing documents (files) in Documents, Downloads and Pictures folders. If possible, how can I now delete those files from the install.wim? I understand that I would first have to mount the image/install.wim. But I don't know what to do next.

    Thank you in advance.

    Kind regards,

    tecknot
      My Computer


  2. Posts : 818
    Windows 7
       #2

    1. Create a temporary mount folder.
    Code:
    mkdir C:\MountDir
    2. Mount the install.wim. For a captured WIM, there's usually only one image (index 1).
    Code:
    DISM /Mount-Wim /wimfile:D:\path\to\install.wim /index:1 /mountdir:C:\MountDir
    3. Delete files as needed from C:\MountDir's subfolders.

    4. Unmount the updated image. Replace /commit with /discard, if you don't want to keep the changes.
    Code:
    DISM /Unmount-Wim /MountDir:C:\MountDir /commit
    5. Remove the temporary folder
    Code:
    rmdir C:\MountDir
      My Computer


  3. Posts : 154
    Dual boot Windows 10 Pro 22H2 (b 19045.4412) and Windows 11 Pro 23H2 (b 22631.3593)
    Thread Starter
       #3

    garlin said:
    ...

    3. Delete files as needed from C:\MountDir's subfolders.
    Hi garlin,

    I appreciate the steps you provided. I have the .wim file mounted, I just don't know how to access the install.wim and delete the offending documents. I know that this is pretty basic, but I never did it before in cmd/DISM.

    Thanks.

    Kind regards,

    tecknot
      My Computer


  4. Posts : 818
    Windows 7
       #4

    After you mounted it, all the files should be present as normal folders.
    ie. C:\MountDir\Users\tecknot\Documents

    As Administrator, you should be able to browse and delete whatever using "rmdir [folder] /s /q".
      My Computer


  5. Posts : 4,619
    several
       #5

    7-zip is one way to do it.
      My Computer


  6. Posts : 154
    Dual boot Windows 10 Pro 22H2 (b 19045.4412) and Windows 11 Pro 23H2 (b 22631.3593)
    Thread Starter
       #6

    garlin said:
    After you mounted it, all the files should be present as normal folders.
    ie. C:\MountDir\Users\tecknot\Documents

    As Administrator, you should be able to browse and delete whatever using "rmdir [folder] /s /q".
    Cool. Thanks, garlin!

    Kind regards,

    tecknot
      My Computer


  7. Posts : 4,619
    several
       #7

    if you have mounted the image, just browse to the offending documents and delete them. What is the purpose of using commands?
      My Computer


  8. Posts : 154
    Dual boot Windows 10 Pro 22H2 (b 19045.4412) and Windows 11 Pro 23H2 (b 22631.3593)
    Thread Starter
       #8

    Hi garlin,

    I tried the command line, but it came back with an error
    Code:
    C:\MountDir\Users\Kramer\Documents: The term 'C:\MountDir\Users\Kramer\Documents' is not recognized as a name of a cmdlet, function, script file, or executable program.
    Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    What did I do wrong? (The user's name is "Kramer".)

    Kind regards,

    tecknot

    - - - Updated - - -

    SIW2 said:
    if you have mounted the image, just browse to the offending documents and delete them. What is the purpose of using commands?
    HI SIW2,

    I don't know how to browse to the offending documents. For instance, I don't know how to list the documents in a folder, much less how to delete them. I'm in PS using DISM.

    Kind regards,

    tecknot

    - - - Updated - - -

    Wait, wait. I think I get it now. I can go through Windows to delete the docs. Is that correct?

    Kind regards,

    tecknot
      My Computer


  9. Posts : 4,619
    several
       #9

    yes just use windows explorer the same as you do with any other folder
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 17:11.
Find Us




Windows 10 Forums