winpe apply-image with access denied with error 5

  1. Posts : 16
    windows 10

    winpe apply-image with access denied with error 5

    I have a WinPE bootable USB drive. Using the bootable drive, I can start the system using WinPE, and I made an install.wim file for the Windows partition. Now, I try to apply this install.wim to the system. I follow the tutorial 84331-apply-windows-image-using-dism-instead-clean-install.html.

    My Windows partition is in E: and install.wim is in F:
    I have
    dism /Apply-Image /ImageFile:F:\install.wim /index:1 /ApplyDir:E:\

    I get an error, access denied, error 05. I would appreciate any help, and thank in advance.
      My Computer

  2. hsehestedt's Avatar
    Posts : 2,428
    Windows 11 Pro, 21H2

    xinren said:
    and I made an install.wim file for the Windows partition. Now, I try to apply this install.wim to the system.
    Could you describe the process that you used to create the install.wim? Was this image created from a reference system that you ran sysprep on in order to generalize the image?
      My Computers

  3. Posts : 16
    windows 10
    Thread Starter

    I have a separate partition and so I store the install.wim on this partition. I boot the system using WinPE, and use dism /capture-image ... to generate the install.wim. I did not run sysprep. I was using the same machine for dism /catpure-image and for dism /apply-image, I thought that sysprep may not need it (precisely, I did not know that sysprep is needed). Is there a tutorial on using sysprep? Thanks in advance.
      My Computer

  4. hsehestedt's Avatar
    Posts : 2,428
    Windows 11 Pro, 21H2

    @xinren, I wasn't trying to imply that you absolutely had to use Sysprep. Truth is, I'm not absolutely certain whether we should expect it to work with generalizing the image, but I do still have a suspicion that this may be the case.

    Take a look at this tutorial, it also by Kari (same author as the tutorial you were following):

    Create media for automated unattended install of Windows 10

    Part seven of that tutorial is where he starts getting into sysprep.

    I have to admit that your scenario has me interested in finding an answer so I plan to test this all myself. However, I already promised a couple of other people to research some other issues so it may be a day or two before I get to this one.

    If you decide to pursue this first, do let me know what you find. Otherwise, I'll post back my results as soon as I can.
      My Computers

  5. hsehestedt's Avatar
    Posts : 2,428
    Windows 11 Pro, 21H2

    Okay, I finished my testing. Worked fine for me both with and without doing a sysprep.

    I definitely suggest sysprepping to avoid creating machines with duplicate SIDs, but if you going to use that image with only a single system, you should be good.

    We may want to compare notes to see what is different between what you are doing and what I am doing, but first, one question:

    What kind of media is your install.wim on? Is it HD, DVD, flash drive?
      My Computers

  6. Posts : 16
    windows 10
    Thread Starter

    I have a separate partition on SSD.

    1. I use winpe usb to boot, and I have winpeinit command window. In the command window, I have
    dism /capture-image /imagefile:E:\install.wim /capturedir:\ /ScratchDir:E:\Scratch /name:"anyname" /compress:fast /checkinetegrity /verify
    In the partition E:, I have an install.wim.
    2. I then reboot the machine and try to use
    dism /apply-image /imagefile:E:\install.wim /Index:1 /ApplyDir:E:\
    I got an error.
    Can I ask how do you get your install.wim? Thanks
      My Computer

  7. hsehestedt's Avatar
    Posts : 2,428
    Windows 11 Pro, 21H2

    xinren, I think I see the problem. When you run the the dism /apply-image command, you are referencing the same drive letter for both the source file (the install.wim that you created) and the drive to which Windows should be deployed. That's no good. Was that possibly a typo?

    Also, I notice that when you create the image, you are leaving off the /bootable switch. That's important.

    Here is a summary of how I am doing it:

    In my case, I was testing with a VM. I installed Win 10 20H2 to the VM and made a few changes to settings, the desktop wallpaper, and a few other personalization settings to make sure that those changes are all there after I reinstall.

    I reboot the system from Windows 10 install media. Since this is a VM, I mount the Windows 10 ISO image as a DVD drive so effectively this is like booting from a Windows installation DVD.

    I then create the image using this command:

    dism /capture-image /imagefile:C:\Image\install.wim /capturedir:C:\ /name:"W10 Pro" /description:"Win 10 Pro 20H2 x64" /ScratchDir:C:\Scratch /compress:maximum /checkintegrity /verify /bootable
    NOTE: The drive letter was not C: In my case, I think it may have been F:, but that really doesn't matter, so long as you reference the drive letter where Windows resides as seen by your boot media. Note that I am saving the image to the same drive that I am imaging but it should be fine to save it elsewhere.

    The big difference I see in my command is that I am using the /bootable switch and you are not.

    I reboot normally and save my install.wim to another location over the network.

    I then burned my install.wim to another ISO and mounted it as a second DVD drive.

    Now, I reboot from my Windows install media again. I follow the steps in the tutorial you referenced to completely wipe the HD and I create a new partition as described in that tutorial.

    I then use this command:

    dism /Apply-Image /ImageFile:D:\install.wim /index:1 /ApplyDir:G:\
    Again, drive letters may be different, but D: is that second DVD drive with the install.wim on it, G: is the large partition where Windows should be installed.

    That's all. After I reboot normally, Windows is installed and it is just as I had set it up prior to imaging.

    Hope this helps! Let me know how it goes. I'm really interested in getting this working for you.
      My Computers

  8. Posts : 16
    windows 10
    Thread Starter


    thanks for the info.
    1. there were two typos in my previous post,

    dism /capture-image /imagefile:E:\install.wim /capturedir:F:\ /ScratchDir:E:\Scratch /name:"anyname" /compress:fast /checkinetegrity /verify /bootable
    where E is the additional partition on the hard drive, and F is the partition with Windows directory.
    Usually, I use diskpart or Powershell to check the volume/partition

    2. I can see that after getting install.wim, you burn it to an ISO, and then mount it as a DVD
    In my case, I simply use this install.wim
    dism /Apply-Image /ImageFile:\install.wim /index:1 /ApplyDir:G:\
    where D: is the additional partition on hard drive and G: is the partition with Windows directory
    Sorry, I have a typo in the previous post.

    3. Somehow, I do not understand the command
    dism /Apply-Image /ImageFile:\install.wim /index:1 /ApplyDir:G:\
    in my case, G: is the partition with Windows and it has a folder G:\Windows. What does /Apply-Image do here?

    4. I have tried two ways to boot it up,
    1). using WinPE bootable
    2). using Windows bootable USB drive
    neither works on dism /Apply-Image.....
      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 10:21.
Find Us

Windows 10 Forums