Sysprep for Windows 7

From FOG Project
Jump to: navigation, search

The sysprep.exe file is located at C:\windows\system32\sysprep.exe. There are a few other files around there, and it is recommended that they be left untouched. However, that does not mean that you cannot add information to this directory. The approaches to managing the sysprep process is varied, and this is just one recommendation.

Additional Necessary Files: c:\windows\system32\sysprepme.bat c:\windows\system32\unattend.noskiprearm.xml c:\windows\system32\unattend.skiprearm.xml

Contents sysprepme.bat:

:start
echo off
echo ================================================================================
echo ================================================================================
echo Choose the appropriate sysprep stage:
echo.
echo 1) For Deployment
echo 2) Create Build Process Restore Point
echo ================================================================================
echo ================================================================================
echo.
set /p type= 

if %type% == 1 goto 1
if %type% == 2 goto 2
goto 3

:1
c:\windows\system32\sysprep\sysprep.exe /quiet /generalize /oobe /shutdown /unattend:c:\windows\system32\sysprep\unattend.noskiprearm.xml
goto 4
:2
c:\windows\system32\sysprep\sysprep.exe /quiet /generalize /oobe /shutdown /unattend:c:\windows\system32\sysprep\unattend.skiprearm.xml
goto 4

:3 
echo.
echo ================================================================================
echo ================================================================================
echo   That didn't look like a 1 or a 2, please try again and make a VALID choice.
echo ================================================================================
echo ================================================================================
pause
goto start
:4

Contents Unattend.{skiprearm|noskiprearm}.xml:

 <?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
   <settings pass="oobeSystem">
      <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <OOBE>
            <HideEULAPage>true</HideEULAPage>
                <NetworkLocation>Work</NetworkLocation>
                <ProtectYourPC>3</ProtectYourPC>
                <SkipMachineOOBE>true</SkipMachineOOBE>
                <SkipUserOOBE>true</SkipUserOOBE>
         </OOBE>
            <RegisteredOwner>COMPANY-NAME-EMPLOYEE</RegisteredOwner>
            <RegisteredOrganization>COMPANY-NAME</RegisteredOrganization>
            <TimeZone>Central Standard Time</TimeZone>
   </component>
        <component name="Microsoft-Windows-International-Core" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <InputLocale>en-US</InputLocale>
            <SystemLocale>en-US</SystemLocale>
            <UILanguage>en-US</UILanguage>
            <UserLocale>en-US</UserLocale>
        </component>
   </settings>
    <settings pass="generalize">
        <component name="Microsoft-Windows-PnpSysprep" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <PersistAllDeviceInstalls>true</PersistAllDeviceInstalls>
        </component>
        <component name="Microsoft-Windows-Security-Licensing-SLC" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
OPTION 1:            <SkipRearm>0</SkipRearm>
OPTION 2:            <SkipRearm>1</SkipRearm>
        </component>
    </settings>
    <settings pass="specialize">
        <component name="Microsoft-Windows-UnattendedJoin" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <Identification>
                <JoinWorkgroup>ghost</JoinWorkgroup>
            </Identification>
        </component>
       <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <ComputerName>COMPANY-BASE</ComputerName>
            <ProductKey>ZZZZZ-ZZZZZ-ZZZZZ-ZZZZZ-ZZZZZ</ProductKey>
        </component>
    </settings>
   <cpi:offlineImage cpi:source="wim:c:/vista/x86/image.wim#Windows Vista ULTIMATE" xmlns:cpi="urn:schemas-microsoft-com:cpi"/>
</unattend>

The reason that you want to use two unattend files is because one will reset some internal Windows stuff, but can only be done three times. The other can be done an infinite number of times, and is what you want to use for the image that you are updating. Once you are ready to capture, use option 1. Just be sure to have a backup from option 2 created so that you don't have to do that work again when you update your image.