Windows PE is one of the most valuable tools for a computer technician. It allows them to be able to work on a Windows operating system while it is off-line. One of the utilities that benefits from this the most is Defrag. The problem is that Defrag is not available by default within Windows PE.
This is how you can add it to your personal copy of Windows PE. Granted this is technically more involved than most people want to get with WinPE and at least in this tutorial I am going to skip the formalities and basics with adding it.
Registry Keys To Add To WinPE:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\EXTERNALSOFTWARE\Classes\CLSID\{80EE4901-33A8-11d1-A213-0080C88593A5}] @=”Defrag NTFS engine”
[HKEY_LOCAL_MACHINE\EXTERNALSOFTWARE\Classes\CLSID\{80EE4901-33A8-11d1-A213-0080C88593A5}\LocalServer32] @=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,72,00,6f,00,6f,00,74,00,25,\ 00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,44,00,66,00,\ 72,00,67,00,4e,00,74,00,66,00,73,00,2e,00,65,00,78,00,65,00,00,00
[HKEY_LOCAL_MACHINE\EXTERNALSOFTWARE\Classes\CLSID\{80EE4902-33A8-11d1-A213-0080C88593A5}] @=”Defrag FAT engine”
[HKEY_LOCAL_MACHINE\EXTERNALSOFTWARE\Classes\CLSID\{80EE4902-33A8-11d1-A213-0080C88593A5}\LocalServer32] @=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,72,00,6f,00,6f,00,74,00,25,\ 00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,44,00,66,00,\ 72,00,67,00,46,00,61,00,74,00,2e,00,65,00,78,00,65,00,00,00
For these files you can copy them from a Vista machine but make sure that the Vista service pack version matches the WinPE service pack version. Make sure to place them in the same locations as they are located on Vista.
Files To Add:
Windows\System32\Defrag.exe
Windows\System32\dfrgfat.exe
Windows\System32\DfrgNtfs.exe
Windows\System32\DfrgRes.dll
Windows\System32\en-US\Defrag.exe.mui
Windows\System32\en-US\DfrgFat.exe.mui
Windows\System32\en-US\DfrgNtfs.exe.mui
Windows\System32\en-US\DfrgRes.dll.mui
Once you have added these files and registry keys to the Windows PE WIM you can then use Defrag via the Windows PE Command Prompt.