DISM Tool – WinPE 3.1 Boot Environment

This is the new tutorial for the recent release of WinPE 3.1. You can still read the old tutorial here.


You will need the following to proceed:

Once you have installed WAIK, and the WAIK supplement, then you will need to browse to your start menu and click on “Deployment Tools Command Prompt”.

Once you have launched DTCP you will need to follow through the commands I have compiled below. The first one I have provided a screenshot.

DISM – Step 1 – Prep/Cleanup

DISM /Cleanup-Wim

The DISM cleanup command simply cleans up any previous wims/mounts you have been working with. If you do this a lot, you will need to use this command otherwise you will start receiving errors from previous wims possibly still left on the system.

DISM Step #1

DISM – Step 2 – Copy WinPE 3.1 to your local C Drive

copype.cmd x86 c:\winpe_x86
copy c:\winpe_x86\winpe.wim c:\winpe_x86\ISO\sourcesboot.wim

This creates a winpe_x86 folder on your C: drive and then copies the contents of the WinPE folder from the WAIK installation to your folder.

DISM – Step 3 – Mounting .Wim File on your local C Drive

Dism /Mount-Wim /WimFile:C:\winpe_x86\winpe.wim /index:1 /MountDir:C:\winpe_x86\mount

DISM - Mounting
This command mounts the wim file that was copied over in step #2 so that you can browse the system32 folder and insert your custom scripts, etc.

READ ALSO  Join Domain and Login over a VPN Connection

DISM – Step 4 – Adding Packages to your WIM

Dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIKTools\PEToolsx\86\WinPE_FP\swinpe-wmi.cab"
Dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIKTools\PEToolsx\86\WinPE_FP\sen-uswinpe-wmi_en-us.cab"

There are many packages you can add to your WINPE boot environment, these are two I always add to mine.

DISM – Step 5 – Adding Drivers to WinPE

DISM /image:c:\winpe_x86\mount /Add-Driver /driver:C:\YOUR_FOLDER_OF_INF_DRIVERS /recurse

A nice addition to DISM over the previous peimg command in WINPE 2.0 is the ability to add drivers with the /recurse command. The /recurse command now allows us to simply have all of our drivers in their own directory and tell DISM to scan the root folder and everything beneath it. The number of sub directories won’t matter. I have a huge library of drivers, for example, you will want to have the network and vga drivers for anything that you boot up to in the WinPE environment. By adding the network driver to your WinPE boot environment, it allows you to access network shares for capturing and deploying .wim images.

DISM – Step 6 – Adding Custom Scripts, Batch Files, Etc.

xcopy /e /y "C:\YOUR_FOLDER_OF_SCRIPTS" C:\winpe_x86\mount\Windows\System32

Without adding anything to your WinPE boot environment you will simply be left with a command prompt window when booting to it on a computer. I have added over 15 different batch scripts with different functions. Click here to download my WinPE discs. One thing I highly suggest adding is GImageX. GImageX is a very small GUI program that you can add to be able to capture, deploy, and mount images within the WinPE boot environment. I have provided a picture of GImageX GUI below.

READ ALSO  Capture and Deploy Image Without Sysprep

For WinPE 3.1 Boot Environment - Mount, Deploy, Capture Images

DISM – Step 7 – Unmounting your finished .WIM

Dism /Unmount-Wim /MountDir:C:\winpe_x86\mount /Commit

This commits the final changes to your .WIM file and anything you added to it. It is very important to unmount your .WIM file when you have finished.

DISM – Step 8 – Copies your .WIM to Boot ISO

copy c:\winpe_x86\winpe.wim c:\winpe_x86\ISO\sources\boot.wim /Y

DISM – Step 9 – Creates bootable .ISO of WinPE 3.1

oscdimg -n -bc:\winpe_x86\etfs\boot.com c:\winpe_x86\ISO c:\winpe_x86\winpe_x86.iso

Now, if you are wanting to use a flash stick you will need to format a flash stick in a certain way, and then simply copy the contents of the c:\winpe_x86\ISO to your flash drive. And thats it! Stick it in a computer, restart, and boot to it. The .ISO made in step #9 can simply be burned to a CD with Nero or other program capable of making bootable CD and then you can boot to it in the same way.

DISM – Step 10 – Optional Backup

xcopy /e /y "C:\winpe_x86" E:\BACKUP_FOLDER_FOR_LATEST_BOOT_BUILD

This step is optional, but I always like to keep a backup for the future. Also, if you ever need to create another bootable flash stick or CD you can simply go to your backup and grab the files.

Cyril Kardashevsky


  1. Meant to post this here. Is the setup the same for 64-bit or are the steps different because of compability issues? Also has anyone compiled anything for 64 bit yet?

    1. Just replace x86 to amd64 where applicable and you should be fine. I just made one myself. The only difference I made was add Dell’s Windows PE drivers (which has a couple overlaps but it is fine). I grabbed it off a Latitude E4310 Windows 7 drivers page, but it includes PE drivers for Latitudes, OptiPlex and Precisions. (includes x86 and x64 drivers)

      1. Ok cool, I made one with a ridiculous amount of drivers. 10.1GB in all, but it was required to cover all of our companies across the US, Mexico, Canda, and Japan. We are about to start supporting Windows 7 Enterprise x64 and I wanted to make sure there wouldn’t be any speed bumps. We have had several different people in our department order PCs across the times, so we have bits and pieces of random junk here and there. I am trying to help them clean all that up and just stick with Dell, but we will see how it goes. We currently use ghost for most of our stuff, but I’m trying to get them into WDS on our servers.

        1. Do you really want to integrate 8GB of drivers into your base image?
          Why don’t you just use a script to get the drivers of your machines and then use hwids to save the machine info
          on deployment run hwids again and if they match up then use the script to pull the extracted drivers back to the local machine

  2. Another question, I wanted to start completely over due to an error I received and was unsure where to go back to. When trying to completely remove the directory it gives me an access denied error. I even tried deleting with the hidden admin account. I tried removing using RD /S {path}. Nothing is working currently. I wanted to start fresh from step 1 and begin again to find out where I made my mistake at. Email listed, please respond. Thanks.

    1. Thanks for the reply. I ended up just uninstalling WAIK and that removed the directory for me. I reinstalled it and began doing the steps. Once I get back into work tomorrow I will work on it again. Thanks for the post. I will keep note of this for future reference.

  3. Thanks, I was able to make this work in my environment. I know my way around batch files and I have a decent menu for us to deploy from.

  4. I am receiving a 1630 error when Adding Packages. I didn’t have this problem with your WinPE 3.0 guide. This only started to happen when I added the supplement for SP1.

    Any ideas?

  5. My issue I have is my bitmap wallpaper ends up being black in WinPE 3.0
    My winpe.bmp that I copy over from my computer to the mounted\system32 folder copies over fine. The file size is correct.
    After I unmount and save the changes to the image, I remounted it to see if my winpe.bmp was even viewable through paint.
    The winpe.bmp is now 26 bytes. I was more like 2 MB before. Everything I save in the mounted system32 folder is there and working.

    Any idea?

  6. Hi itbro,
    I noticed you’ve added the script for all dell drivers, can you also assist with hp drivers? I am having issues with 8200 elite sff and loading 82579lm driver.

      1. I will need to, but haven’t yet, integrate the HP drivers. I think that the swsetup folder needs to be the source root, correct?

        I’ve noticed that in your scripts, but not included with your drives, there are references to the dell drivers in the driveradditions.txt… Is this essential to the driver integration process to the win7pe? I think it’s great that you’re listing what drivers are integrated but I wasn’t sure if something looks at that file to see if it is integrated.

        But I had a question: Wouldn’t it be eaiser to use something like driverpack and extract and insert into the WIM? (a speculation since it’s what I used to use for BartPE and slipstreaming updates into XP disks)

        By the way, AWESOME work on this stuff to help take out all the guesswork. I’ve read the Win 7 Resource Kit a few times and MS online for it to finally sink in a bit and then your site helped it really stick home with all this win7pe stuff.

    1. This is what I did:

      Download and execute for extraction, but cancelled installation (not on an 8200, but require the drivers)

      c:\winpe_x86>DISM /image:c:\winpe_x86\mount /Add-Driver /driver:C:\SWSetup\8200_
      NIC_SP52368 /recurse

      Deployment Image Servicing and Management tool
      Version: 6.1.7600.16385

      Image Version: 6.1.7601.17514

      Searching for driver packages to install…
      Found 15 driver package(s) to install.
      Installing 1 of 15 – C:\SWSetup\8200_NIC_SP52368\E1C6232.INF: The driver package
      was successfully installed.
      Installing 2 of 15 – C:\SWSetup\8200_NIC_SP52368\e1e6232.INF: The driver package
      was successfully installed.
      Installing 3 of 15 – C:\SWSetup\8200_NIC_SP52368\e1k6232.inf: The driver package
      was successfully installed.
      Installing 4 of 15 – C:\SWSetup\8200_NIC_SP52368\E1Q6232.inf: The driver package
      was successfully installed.
      Installing 5 of 15 – C:\SWSetup\8200_NIC_SP52368\e1r6232.inf: The driver package
      was successfully installed.
      Installing 6 of 15 – C:\SWSetup\8200_NIC_SP52368\e1y6232.INF: The driver package
      was successfully installed.
      Installing 7 of 15 – C:\SWSetup\8200_NIC_SP52368\install\DRIVERS\ANSM2KXP.INF: T
      he driver package was successfully installed.
      Installing 8 of 15 – C:\SWSetup\8200_NIC_SP52368\install\DRIVERS\ansmw60.inf: Th
      e driver package was successfully installed.
      Installing 9 of 15 – C:\SWSetup\8200_NIC_SP52368\install\DRIVERS\ANSP2KXP.INF: T
      he driver package was successfully installed.
      Installing 10 of 15 – C:\SWSetup\8200_NIC_SP52368\install\DRIVERS\anspw60.inf: T
      he driver package was successfully installed.
      Installing 11 of 15 – C:\SWSetup\8200_NIC_SP52368\install\DRIVERS\ifcoemp.inf: T
      he driver package was successfully installed.
      Installing 12 of 15 – C:\SWSetup\8200_NIC_SP52368\install\DRIVERS\ifcoepr.inf: T
      he driver package was successfully installed.
      Installing 13 of 15 – C:\SWSetup\8200_NIC_SP52368\install\DRIVERS\ifcoevb.inf: T
      he driver package was successfully installed.
      Installing 14 of 15 – C:\SWSetup\8200_NIC_SP52368\install\DRIVERS\ilp5232.inf: T
      he driver package was successfully installed.
      Installing 15 of 15 – C:\SWSetup\8200_NIC_SP52368\install\DRIVERS\ilp6032.inf: T
      he driver package was successfully installed.
      The operation completed successfully.

      I would have to conclude that if you do the same for the other drivers you need it should work.

  7. How can I keep WinPE from cluttering up DNS with mini ___ (series of numbers & letters) entries? Could I tell it to use a range of IP’s? My DNS Admin isnt a happy camper :-)

    Thanks for the help !!

  8. You might also want to include instructions to copy imagex.exe into the PE. It can come in handy if you want to do something from the command line.

    1. Good god this is what is what I need. Do you have this step or command so I can get it working along with it mapped properly so I can browse to other folders? This is the one thing that makes this whole thing useless to me. While using GimageX is nice, I tend to use my own scripts from the command line.

  9. Brain thanks for the great posts!
    I was wondering it there was a way to get the script with ghost still as my group still uses it. I am working on moving to imageX and MDT but we are just not their yet.

  10. Hello, nice one your script and compilation. Bravo!
    Just one thing….do you know if we can add source for a mouse driver? and if yes how to do that? will be more easy/fast in Gimagex.

    Thanks a lot

  11. Hi,
    I’m very new to this set up. I like the idea of being able to create a WIM image. How do I make that available over the network. I obviously need to put a wim on a network share, just not sure how clients see that. I would also guess the bios boot be changed in order to boot to the network. I don’t like guessing so basic steps on this please.

  12. Thanks for the great walkthrough. I am imaging windows 7 Ultimate 64 bit and changed the X86 items to amd64 as stated above but on step 3 I receive an
    ERROR 13
    The data is invalid
    I’m not sure which data it is referring to
    Thanks again

  13. Hi Brian,

    For whatever reason ImageX does not work. My WinPE 3.0 without your scripts works just fine and I can run my custom batch files for capturing and deploying. However, following your instructions here I cannot get my custom scripts to run. It seems that ImageX just isn’t mapped or installed. What am I missing here? I’ve spent all day updating my process to once again run into a snag. The official MS WinPE instructions have a step to copy the ImageX executable during the creation process but I do not see that here.

  14. Hello,
    Great article and easy to follow…
    I’m trying to create a 64-bit WinPE disk and I have followed the instructions above (substituted x86 for amd64 on all commands). The WinPE disk I created for x86 works fine.
    How do I create a bootable ISO image using the ‘oscdimg’ command and could you tell me if I need to do anything else?
    Many Thanks

  15. When I execute step 3 I get the following error:

    Logging is disabled: Unable to obtain access to the log file C:\Windows\Logs\DIS

    Error: 5

    Access is denied.

    I have checked the permissions of these folders and I have full write access. I also tried running the command prompt as administrator and the error is still there.

    Do you know why this is happening?

  16. @Lee
    You need to copy the below files from C:\Program Files\Windows AIK\Tools\x86 to your GImageX folder

  17. Hi Brian –

    I am completely new to this entire process. I have successfully created the bootable flash drive with the WinPE 3 boot environment. My problem now is figuring out how to use GImageX. I’ve searched online for documentation, but I’m coming up with nothing. Is there any documentation on how to use this?

  18. Anyone know why we copy the boot.wim to ISO/sources…
    Then mount it..
    And then copy it over to ISO/sources again?..

    What’s the purpose of the first copy? For backup?

  19. It is curiouso to me why these instructions don’t include an Export (after committing the wim). If you do any mounted install.wim work like integrating updates, drivers, etc., and then do only a save/commit when you are done, the install.wim will remain quite a bit larger than it needs to be. For example, I just integrated 300mb of drivers to an install.wim, which in actuality added about a little more than 200mb to the actual wim as I was done and committed it. I then exported the install.wim and I ended up with only about 115mb added to my final install.wim.

  20. The WAIK download always has a cab file that is corrupted so, I was just replacing them with saves from a different CD we had which fixed it (checked the modified date / time and both were the same). Every download is the same and I have tried installing it on multiple PC’s / Windows OS (7, x32 and x64)

    Then somewhere in between updating the image files with your scripts and un-mounting the image, the scripts are not being copied.

    I opened up the boot.wim with 7z to verify this, the winpe.png is not edited to the blue blackground and I can not find any of the bat scripts that were copied over. I even manually moved them over to the mount/windows/system32/ folder to make for sure they were being placed correctly.

    At a loss on what to do at the moment, since this is how I was deploying previously and the USB got misplaced.

  21. d:winpeamd64>oscdimg -n -b d:winpeamd64etfsboot.com d:winpeamd64ISOwinpe_x

    OSCDIMG 2.55 CD-ROM and DVD-ROM Premastering Utility
    Copyright (C) Microsoft, 1993-2007. All rights reserved.
    Licensed only for producing Microsoft authorized content.

    Scanning source tree
    ERROR: Failure enumerating files in directory “D:WINPEAMD64ûB”
    Error 3: The system cannot find the path specified.


  22. “Now, if you are wanting to use a flash stick you will need to format a flash stick in a certain way, and then simply copy the contents of the c:winpe_x86ISO to your flash drive. ”

    fat=32 ? Active ? Partition ID = 0x7 or 0x27 ? or just don’t worry about the ID ?

    I think just format fat 32 and make active, another method is to use a tool like Novicorp win to flash.

  23. Used power iso – create bootable usb and then the Iso created in step 9 as the source. The first time the files from “content_x86 did not get committed to the boot.wim file. I had to remount and the manually copy using the explorer, recommit and create new iso to apply to usb. One snag Gimagex does not work…says something like missing required subsystem…the image is not supported, I did copy the imagex files to the “content_x86” directory before transferring to mounted boot.wim file. ???
    This happen when using your installer.cmd menu or directly executing it.

  24. I just ran the usb drive on my blank reference machine. when I use the installer menu and select 2 for GImagex a second command window pops up and flashes a way then I am dumped in to a command prompt…X:windowssystem32>gimagex… the response is “The subsystem needed to support the image type is not present.” M$ imagex works fine? Are there other packages that need to be added to the boot.wim? winpe-setup.cab?

  25. I found out the problem. the PE 3.1 content_x86.zip comes with a 32bit gimagex.exe only. I found on you autoitscript web page a file called gimagex.zip which has both versions (x86, x64) of the file gimagex.exe. I am creating a x64 pe environment therefor the 32 bit version that came with the content_x86.zip would not work.

    1. When you are using GImageX the EXE in the WinPE environment everything is already 32bit… If you are just applying images to 64bit machines, no 64bit WinPE or Gimagex is required. Hopefully that makes sense. You don’t have to have a 64bit WinPE or Gimagex to apply a 64bit captured image. That is why it isn’t in the post above.

      1. There are two winpe.wim files…
        C:Program FilesWindows AIKToolsPEToolsamd64winpe.wim (132,290KB)
        C:Program FilesWindows AIKToolsPEToolsx86winpe.wim (111,658KB)
        Gimagex x64 (249KB)
        Gimagex x86 (193KB)

        Now that I think about it for the purpose of the boot disk you can manipulate the image files in a Winpe x86 booted software environment. I guess it is just a creature of habit since you can’t use a win 7 repair disk (x86) to fix an installed win7 (x64) os or visa versa. I was just applying the gimagex x86 that cane with the content_x86.zip in to the winpe,wim x64. I was thinking about just throwing your files in to a win 7 repair disk boot.wim file,(system32) this way I could get to a command prompt to use your tools and still use the disk to repair an installation. or just put your tools into a directory of the media. (%root%tools)

        1. You are totally correct. If you try to launch a Windows 7 x64 disc from a USB drive running WinPE x32 you will in fact get an error, or vice versa. If you are just applying images using Gimagex, then 32bit will work for both. I ran into the same issue. Ah the joys of imaging.

          I actually do have a x64 bit WinPE version in an older post here: https://theitbros.com/winpe-3-0-scripts/

          1. I ran in to another problem creating my reference machine. I performed a virgin install of win 7 ult x64, when it got to the add user screen I pressed control+shift+f3 to reboot in to audit mode. the problem :-( when it rebooted it logged in as administrator with a temporary profile that gets removed every time it reboots. I’m hoping this works, I finalized updates/java/adobe products enabled administrator account then customized the system. copied the temp profile manually to another location then ran sysprep /generalize /oobe put in a user name “Harry” log off then log back on as Administrator copy the temp profile to Administrator then run sysprep in audit mode again to see if the profile sticks. If ok the run sysprep /generalize /oobe which will remove user “Harry” and shutdown. Use your tools disk to capture the image and then format reference machine and see how it works when I apply the image.
            Wish me luck!!!

  26. There is something I should bring to your attention, it has to do with the imager.cmd menu.

    I inserted your scripts in to a pe environment and then booted from it on my main system to check it out. I was dumped in to your menu system and selected 1 pressed enter not knowing that it would start an automated process on disk 0 that can not be stopped or reversed. Disk 0 “WAS” one of my Seagate 1TB data storage drives :-( Data recovery software (Easy Recovery/Partition Wizard) has yet to be able to get the data back even though I have not accessed the drive directly since, Windows did write a small amount to make $Recycle bin and System Volume Information directories. I did delete the “CDRIVE” partition to stop Windows from accessing it anymore. I would be nice if the selection “1. Diskpart” would invoke a second cmd window with a listing of available disks to select and then choose an existing partition or create one of a size that you choose in MB instead if the whole drive. Even better a front end GUI for Diskpart like you made for Imagex. I know I don’t ask for much.

  27. So I have created multiple bootable thumbdrives to boot into winpe with gimagex and now when I create a thumbdrive it just boots up to x:windowssystem32 prompt. I added your winpe scripts not sure what I am missing?

  28. Brian, I have been trying to use your system but am not having much success. If I use your diskpart script it cleans the drive but any image I drop on the computer after that can not find the operating system.
    I created a 64 bit ufd and loaded your menu and scripts on it. Ghost did not work and I could not find ImageX on the stick even though I included that in the ISO before I committed it. At any rate, if I use GimageX to create a Boot image and verify it and check it then Gimagex does make the image but I can not get the image to work. If I verify and check the downloaded image on another box of the identical hardware then GimageX errors out in the check with a WindowsSoftwareDistributionauthcabs err=3. If I do not verify and check the image it does deploy but is unbootable.
    What am I missing? Even if I use a different ufd and run ImageX and create an image from the master and then use Gimagex or ImageX to deploy it the device will not boot. This image is a complete master image with all apps and windows updates installed. It is not named Boot.wim. The box that the master is on works correctly and sysprep has not been run yet (because it is my master image).
    The process is straight forward. It is a Windows 7 Enterprise 64bit install with many applications already installed. I boot to my UFD which is compiled with your scripts (modified to map my network shares but otherwise unchanged). Once booted I run GImageX and capture a Boot image and tell it to verify and check using Fast compression and upload that image to a network share and/or an external usb hard drive. Once it is created I change to the target machine and boot from the ufd and run Diskpart to clean the drive and then run GImageX and “Apply” the image which takes 29 minutes without verify or check and 186 minutes with Verify and Check enabled. Once completed I reboot and find that the system can not boot an find an operating system. These computers are on Intel (DQ67 in this case) motherboard desktops. Is there anything you can see that I am not doing correctly?
    Thank you.
    Jim Pruitt

  29. Brian, how does winpe.wim show up? In step 2 you have us copy it to another directory but there is no winpe.wim in C:winpe_amd64 for me to copy to ISOsources.
    Also as Enders T was saying, I wonder if my using the Windows 8.1 install CD for the winpe files is what causes ImageX and GimageX to corrup my captured images?
    Also, what does install.wim get used for and when? The Microsoft pages are not real clear on that and in the case of customized images how is the capture different? Do we not just make the boot usb stick from your write-up and then capture an image from the master computer and then “Apply” that image to a target machine?
    Also your diskpart script does not create a system partition that is required for booting (according to the Microsoft Walkthrough papers). How is this different (if it is) for UEFI systems compared to AHCI drives?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.