Microsoft Windows Registry Guide, Second Edition
Removing the Paging File
By using the registry, you can remove the Windows paging file before running Sysprep. Simply change the REG_MULTI_SZ value PagingFiles to C:\pagefile.sys 0 0 immediately before running Sysprep. This value is in HKLM\SYSTEM\CurrentControlSet\Control\ Session Manager\Memory Management. The easiest way to change this value is to export the setting to a REG file (remove all settings but the PagingFiles setting from the REG file), and then add it to a batch file that also starts Sysprep with the command-line options that you need for creating the image. For example, you can add the command %SystemDrive%\Sysprep\Sysprep.cmd to the [GuiRunOnce] section of the Sysprep.inf file, and then add the following lines of code to the Sysprep.cmd file:
Regedit /s %SYSTEMDRIVE%\Sysprep\pagefile.reg %SYSTEMDRIVE%\Sysprep\Sysprep.exe -mini -quiet -reseal -forceshutdown