Creating a WIM file containing the Windows RE

John Savill

October 9, 2007

1 Min Read
ITPro Today logo in a gray background | ITPro Today

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 http://www.microsoft.com/downloads/details.aspx?FamilyID=c7d4bc6d-15f3-4284-9123-679830d629f2&DisplayLang=en#Instructions). 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:tempwinre_imagemkdir d:tempwinre_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 FilesWindows AIKToolsPETools>imagex /export /boot "D:OS ImagesWindows Vista Final English DVD Images (x86 and x64)boot.wim" 2 d:tempwinre_imagewinre.wim "Windows RE"
  3. Now mount the new RE image, by using this command:

    C:Program FilesWindows AIKToolsPETools>imagex /mountrw d:tempwinre_imagewinre.wim 1 d:tempwinre_mount 
  4. Navigate to the d:tempwinre_mountWindowsSystem32 folder and create a file called winpeshl.ini. In winpeshl.ini add the following text:

    [LaunchApp] AppPath=x:sourcesrecoveryrecenv.exe 
  5. Optionally, you can add more storage drivers via the peimg command, as the following example shows:

     peimg.exe /inf= d:tempwinre_mountWindows 
  6. Dismount the imageby usinf the following command:D:tempwinre_mountWindowsSystem32>imagex /unmount /commit d:tempwinre_mount

You now have a WIM file with the Windows RE environment, which you could use, for example, with Windows Deployment Services (WDS).

— John Savill

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like