Clean Up before Sysprep


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
image

image

image

2. For windows 7 and Server 2008, download “KB2852386

3. Go to DeploymentShare –> Packages and create a folder called “Windows 7 x64”
image

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.

5. Go to: DeploymentShare –> Advanced Configuration –> Selection Profiles. Right click choose “New Selection Profile”
image

image

image

image

6. Edit your task sequence and make sure the you have selected “All Packages” or “Windows 7 x64” in this step: Preinstall –> Apply Patches –> Selection profile
image 

7. Create The follow groups and steps in your task sequence
image

image

That’s it. You have now created a smaller wim file.