Clean-up Before Sysprep And Capture To Reduce The WIM File Size

By | February 21, 2018
Share

Wally Mead (DeploymentBunny) wrote a great script that accommodates his image factory.  It performs several clean up operations before running sysprep.  I run it manually on all of my Virtual Machines prior to running a Sysprep and Capture routine. I’ve seen this script reduce a WIM file by 10GB.

  1. Jump to Wally’s github and save the script you’re your MDT Deployment Share’s script folder: https://raw.githubusercontent.com/DeploymentBunny/Files/master/Tools/Action-CleanupBeforeSysprep/Action-CleanupBeforeSysprep.wsf

  2. From your Virtual Machine, map a drive to your Deployment Share and run the ZTIGather.wsf script. The purpose we run this first is to populate the OSCurrentVersion Task Sequence variable, which Wally’s script relies on.
    REM MAP Z TO DEPLOY SHARE
    net use z: \\bg\cookcounty /user:bg\mdt
    
    REM CHANGE DIRECTORY TO CONTROL FOLDER
    cd /d z:\control
    
    REM RUN ZTIGATHER TO POP OSCURRENTVERSION
    cscript.exe ..\scripts\ztigather.wsf /debug:true

     

    Note: I run the script from the control folder, so it can locate my “CustomSettings.ini”. This is not required, but a good in practice.

  3. Lastly, run the “Action-CleanupBeforeSysprep.wsf” and get a coffee. This script could take an hour to run depending on how defragmented the drive is.

4 thoughts on “Clean-up Before Sysprep And Capture To Reduce The WIM File Size

  1. matt

    also….I don’t think it does any defragging of defragmented drives.

    Reply
  2. Mr. Ern Reynolds

    I’ve been using your file ModelMarkBreakdown-2014Apr03.xlsx but some especially cryptic references (while compact) are beyond my understanding. Clarify for me please the use of the *. The note in the “Breakdown of Serial Numbers” indicates it represents the unit number on the production line.

    However, the * appears in different locations in the model number, sometimes with two different locations of the *, and with 1-6 place holders. Typically the * is a wildcard indicator and its purpose is to accept all characters after the *.

    Reply

Leave a Reply

Your email address will not be published.

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.