Creating a WIM file containing the Windows RE

Q. In Windows Vista, how do I create a Windows Imaging Format (WIM) file containing the Windows Recovery Environment (RE)?

A. The Windows RE is essentially a Windows Preinstallation Environment (WinPE) instance that calls the Recovery Environment (recenv.exe) file at startup. You can therefore create a WIM file containing WinPE, which will run recenv.exe on initialization. To perform this you must install the Windows Automated Installation Kit (AIK), which you can download at To create the WIM file, perform these steps:

  1. Create a new folder to hold the Windows RE and a folder to mount the created RE WIM file. To do so, use the following commands:
    mkdir d:\temp\winre_image
    mkdir d:\temp\winre_mount 
  2. Extract the second image from the boot.wim of the Vista media into a new RE WIM file. The second image contains the Windows Longhorn setup version of WinPE. Use the following command to extract the image:
    C:\Program Files\Windows AIK\Tools\PETools>imagex /export /boot "D:\OS Images\Windows Vista Final English DVD Images (x86 and x64)\boot.wim" 2 d:\temp\winre_image\winre.wim "Windows RE"
  3. Now mount the new RE image, by using this command:
    C:\Program Files\Windows AIK\Tools\PETools>imagex /mountrw d:\temp\winre_image\winre.wim 1 d:\temp\winre_mount
  4. Navigate to the d:\temp\winre_mount\Windows\System32 folder and create a file called winpeshl.ini. In winpeshl.ini add the following text:
  5. Optionally, you can add more storage drivers via the peimg command, as the following example shows:
     peimg.exe /inf= d:\temp\winre_mount\Windows 
  6. Dismount the imageby usinf the following command: D:\temp\winre_mount\Windows\System32>imagex /unmount /commit d:\temp\winre_mount
You now have a WIM file with the Windows RE environment, which you could use, for example, with Windows Deployment Services (WDS).
Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.