I use MDT to build the image I deploy with SCCM. When the image have been patched, there is a lot of superseded patches and temp files. With this script “Action-CleanupBeforeSysprep-2_4.wsf” you can remove a lot of the files that are not needed anymore. It is about 1 GB you can compress the image. For Windows 8 + Windows 8.1 + Windows 10, you can skip step 2 to 6. Thanks to Mikael Nystrom blog post for the inspiration.
1. Download “Action-CleanupBeforeSysprep-2_4.wsf” and create an application in MDT
2. For windows 7 and Server 2008, download “KB2852386”
4. Right click “Windows 7 x64” and choose “Import OS Packages”. Browse to the file that you downloaded in step 2 and complete the wizard.
That’s it. You have now created a smaller wim file.