Expanding the Scratch Space in Windows PE 2.1

Recently, I have had to create a bigger scratch space (the MDT X: drive) in Windows PE to deal with the injection of a largish driver during a Windows Vista deployment. The driver in question is the NVidia driver for the Lenovo P60 and P61 and because of the limited scratch space under PE 2.0, this was causing an issue at injection time. There is a scratch file change (registry hack) that can be made to Windows PE 2.0 and below to change the scratch file space from the default 32 Mb - however this is unsupported.

With the introduction of Windows PE 2.1 (supplied with the Windows Automated Installation Kit (Windows AIK) 1.1), the scratch area can be changed from the command line. Below is the process for creating a larger scratch area.

  1. Create a temporary mount folder on your hard disk - MD c:\temp\mount
  2. Go to the Windows AIK tools folder for the platform of PE that you will be changing (ie x86/x64) - CD "Program Files\Windows AIK\Tools\x86"
  3. Mount the default Windows PE image supplied with Windows AIK to your temporary mount folder - imagex.exe /MOUNTRW "C:\Program Files\Windows AIK\Tools\PETools\x86\winpe.wim" 1 c:\temp\mount
  4. Go to the Windows AIK PETools folder - CD "C:\Program Files\Windows AIK\Tools\PETools"
  5. Run the PEIMG command to adjust the scratch size in the mounted image using /SCRATCHSPACE flag to set the size of the drive you want (in this case 128Mb)  - peimg.exe /SCRATCHSPACE=128 c:\temp\mount\windows
  6. Change back to the PETools directory - CD "Program Files\Windows AIK\Tools\x86"
  7. Unmount the image and commit the changes - imagex.exe /UNMOUNT /COMMIT c:\temp\mount

That's it - the scratch area will now be set at 128 Mb for all boot images based on this source - which means all boot images created by MDT will now have the set scratch space set (there's a script here somewhere to automate this - so feel free to create and send in your suggestions via the comments area :-)).

Remember that the scratch space is a RAM drive, so the machine being built by this boot environment will need enough memory to deal with Windows PE plus your additional scratch space (so that's approximately 240 Mb plus scratch space).

This post was contributed by Richard Smith a Senior Consultant with Microsoft Services, UK.