Deployment Image Servicing and Management (DISM) – WinPE 3.0 Boot Environment

I recently compiled a new library of commands since the upgrade from WinPE 2.0 to WinPE 3.0. With Windows 7 coming along they released a new way to create bootable USB sticks using Deployment Image Servicing and Management (DISM.exe). You might be asking yourself, what could I use this for? We are using it at my work to re-image computers, capture backup images, mount images, etc. There are many other uses for it but I will not get into that here. I have literally done this procedure a couple hundred times. In a future article I will show you how to write a simple batch script to automate this process. But it helps to understand what is going on with each command in case you have trouble. Batch scripts never work 100% of the time.

You will need the following to proceed:
Windows® Automated Installation Kit (AIK) for Windows® 7 RC (Download from Microsoft) : 05.01.09

  • Windows® Automated Installation Kit (AIK) for Windows® 7 RC (Download from Microsoft) : 08.06.09
  • Bootable Flash drive (500MB or larger)
  • Once you have installed WAIK then you will need to browse to your start menu and click on “Deployment Tools Command Prompt”. I have provided a picture below.

    DISM

    DISM

    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 #1

    DISM – Step #2 – Copy WinPE 3.0 to your local C Drive

    copype.cmd x86 c:winpe_x86
    copy c:winpe_x86winpe.wim c:winpe_x86ISOsourcesboot.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_x86winpe.wim /index:1 /MountDir:C:winpe_x86mount

    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.

    DISM – Step #4 – Adding Packages to your WIM

    Dism /image:C:winpe_x86mount /Add-Package /PackagePath:”C:Program FilesWindows AIKToolsPEToolsx86WinPE_FPswinpe-wmi.cab”
    Dism /image:C:winpe_x86mount /Add-Package /PackagePath:”C:Program FilesWindows AIKToolsPEToolsx86WinPE_FPsen-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_x86mount /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_x86mountWindowsSystem32

    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.

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

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

    DISM – Step #7 – Unmounting your finished .WIM

    Dism /Unmount-Wim /MountDir:C:winpe_x86mount /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_x86winpe.wim c:winpe_x86ISOsourcesboot.wim /Y

    DISM – Step #9 – Creates bootable .ISO of WinPE 3.0

    oscdimg -n -bc:winpe_x86etfsboot.com c:winpe_x86ISO c:winpe_x86winpe_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_x86ISO 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.

    Tags: , , , , , , ,

    134 Responses to “Deployment Image Servicing and Management (DISM) – WinPE 3.0 Boot Environment”

    1. Dennis says:

      Hey Brian,

      I muxt say that your guide helped me alot:) thnx
      but,

      I tried to download your driver map, but i get some critical errors when trying to open the archive with either Winrar or 7-zip.

      You have any idea how to fix this?
      thnx

      //Dennis

    2. Stuart says:

      Brian,

      Is there a way of determining speed/duplex or setting speed/duplex for a NIC in a WinPE 3.0 boot environment ?

      Thanks

    3. Scott Scanlon says:

      I didn’t see an option to post comments on the WinPE 3.0 Boot Environment Scripts page, so I’m commenting here…

      I can’t find any directions for using the “WinPE3.0_Contents_x86″ files. Do you copy them over to your winpe.iso using something like Magic ISO? And to what directory?

      Also what files within “WinPE3.0_Contents_x86.zip” need to be customized?

      I have found Symantecs Ghost to be the easiest for adding drivers, but I’m not sure how to customize it with these files. Has anyone gone that route?

      Thanks.

    4. SCOTT SCANLON says:

      I didn’t see an option to post comments on the WinPE 3.0 Boot Environment Scripts page, so I’m commenting here…

      I can’t find any directions for using the “WinPE3.0_Contents_x86″ files. Do you copy them over to your winpe.iso using something like Magic ISO? And to what directory?

      Also what files within “WinPE3.0_Contents_x86.zip” need to be customized?

      I have found Symantecs Ghost to be the easiest for adding drivers, but I’m not sure how to customize it with these files. Has anyone gone that route?

      Thanks.

    5. SCOTT SCANLON says:

      do i copy the contents via:
      xcopy /e /y “C:\WinPE3.0_Contents_x86″ C:\winpe_x86\mount\Windows\System32\

    6. Gary says:

      Thanks man – you rule!

    7. Iain says:

      Excellent – thanks mate!

    8. Marco says:

      So Brian, I have successfully implemented your instructions, but have run into a snafu with a elite book 2540p. I get an error message “WDSClient: an error occured while starting networking” and I know it is related to the drivers injected in to my boot.wim. My problem is that i have downloaded the latest driver from intel for the 82577LM and it still fails. I injected all versions of the driver.

      Thanks,
      marco

    9. Daniel Lopes says:

      is there any way to remove the “Press any key to start from CD / DVD” Option ??

    10. Edward Tippelt says:

      del /q c:\winpe_x86\iso\boot\bootfix.bin should do it

    11. Erik Sundin says:

      I had issues mapping a network drive in PE 3.0 (vs 2003 server). The sollution was to add this DWORD to the winPE registry:

      HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\LmCompatibilityLevel=2

      Apparently Windows 7 (and PE 3.0) defaults LmCompatibilityLevel to 3.

    12. Deb says:

      I am a bit confused on your instructions versus the instructions Microsoft has posted. Am I supposed to run your instructions on the customized machine?

    13. [...] Brian Lee Jackson // Licence Creative Commons Paternité 2.0 France – Dsfc Catégories : BartPe, Dism, GimageX, ImageX, Live Cd Windows, LiveCd, LiveCd Windows 7, News, Nu2, Oscd, Windows, Windows 7, Windows AIK, WinPe 3.0 [...]

    14. Brian Ly says:

      Hi,

      I’m not 100% sure what I need to do with step 4, do I copy the whole command into the command prompt;

      Dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:”C:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-wmi.cab”
      Dism /image:C:\winpe_x86\mount /Add-Package /PackagePath:”C:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\en-us\winpe-wmi_en-us.cab”

      Or do I need to make some changes to it. I get the error:

      Dism doesn’t recognise the command line option “files\windows”

    15. [...] found THIS and THIS article to be useful, in case you have any other questions. Print, email, or share on your [...]

    16. Andrew says:

      I get the same problem as Brian Ly when i copy it in, when i write it in myself i get a problem saying package isnt a identified command?

      anyone have any suggestions on how i can get past this.

      Thanks

    17. Kosta says:

      i have a problem with Unmounting your finished .WIM step

      it used to work when i did it without the addition of your scripts,now when i added your batch files to the system32 in the wim file after i run step 7 i get error 50 “the request is not supported”

      any sujjestions??

    18. Bert Martin says:

      Brian Ly,

      I too had the same issue… I resolved it by removing the quotes around the packagepath and retyping the quotes

    19. Mitchell G says:

      Help. I have been using DISM for a year and I have never had a problem using it. Today I ran into Error: 0xc1420114
      The user attempted to mount to a directory that is not empty.

      Error: 50
      DISM does not support servicing a Windows Vista RTM or earlier operation system. If the operating system is supported check that SSShim.DLL is present.

      I was trying to run build-standard to update drivers. I never had this issue up until today. Can someone shed some light on this for me. I use XP PRo.

    20. Justin says:

      I fallowed your directions to the letter and i cant boot into pe at all. please help

    21. Travis says:

      Error: 0xc1420114

      Check the folder that you are trying to mount the win image into. I have seen this error when that folder is not empty.

      ie. if your command line is:
      c:\DISM.exe /mount-wim /wimfile:c:\wims\install.wim /index:1 /mountdir:c:\isostorage

      Check to make sure that c:\isostorage is empty.

    22. Lucy B. says:

      Hello Brian,

      Your article is very helpful. I have a question. This works also when you try to capture an image for Win 7 64 bit? I tried and it didn’t work so I wonder if that is the reason.
      Thanks for your help and thank you for posting excellent information in your blog.

      Lucy :-)

    23. Lucy B. says:

      Never mind Brian. It worked for me today. I guess I did something wrong yesterday. Thank you again for your valuable information.

    24. Jamaal says:

      When I boot up into the USB, I have the drive in the laptop I want to have the image, re copied the 4 folders from the ISO folder to the USB, still get an error when I go to option 6. If I try to mount it, I get an error that the image is corrupted

    25. Patrick O says:

      hi Brain
      First off, fantastic guides. Not having used dos prompt since i was 12 years old, i was able in 3 days to read the various articles, create my bootable CD with all the files i needed and get Gimagex up and running. The only snaffu i run into is trying to use Gimagex to create the image. I’ve got my main drive (D:) set as source and my external drive (g:, NTFS) set as my destination. However, when i click append, it tells me that i can’t write to g:. I’m not sure why this is since the external drive was freshly formatted and Gimagex lets me select it as the destination. Any thoughts would be helpful, and it not, keep up the fantastic work.
      Cheers

    26. AA says:

      What about booting pxe, is that possible using this image?

      Thanks.

    27. Eric Kolotyluk says:

      DISM – Step #5 – Adding Drivers to WinPE

      This step is a huge disappointment and frustration in what otherwise would have been a nice article. What is supposed to go in C:\YOUR_FOLDER_OF_INF_DRIVERS\ – You refer to “I have a huge library of drivers” but you give no clue on where we are supposed to get them from.

      At least in step 6 you say where to get stuff for the C:\YOUR_FOLDER_OF_SCRIPTS. I would have been really nice if you could have done the same for step 5.

      Anyway, for someone trying to follow your steps – step 5 is a huge road-block.

    28. Bastian says:

      @AA
      Sure it is. After step#7 you’re left with an WIM image. Just add this one to your WDS as a startimage (in case you’re using WDS)

    29. Greg Toscano says:

      How do I add more network drivers to your existing winpe?

    30. Tom Ybarrondo says:

      Okay, here’s my issue, everything worked as it should for me except, when I copied over the modified .wim file to the server, imported it using WDS, (Yes I took the previous offline first), tried both replacing and just adding the new .wim file, it did not show up on the pxe boot menu. Any ideas, cause I have followed the instructions, which are in the help files verbatim I might add and still have no luck…anyone…anyone…Bueller

    31. [...] with the new generation UEFI BIOS on this device doesn’t understand NTFS.  I had to create a new WinPE USB Boot Key that was FAT32 because the ones I had created previously wouldn’t work. [...]

    32. Bob says:

      How do you add networking to Winpe 3 ?

    33. Nalin says:

      Hi Brian,

      Very good article. Can I ask ? is it possible to add software up date CAB file ( obtained via expand command on a .msu file) to a WIM using /add package ?

      Thanks.

    Leave a Reply