Tuesday, May 3, 2011

Simple Sysprep for Enterprise

I've already posted about eSATA, and how once you've built your PC with the wrong BIOS setting, then changing the BIOS will cause a BSOD. The answer was to Sysprep the machine and then change the BIOS. If your computer is fully built, you'll want the least damage done to your computer. Basically, you just want to rip the hardware profile out so that it rebuilds on the next reboot.
Through much trial-and-error, I came up with the following two-part system.

A script, SysprepLaunch_x64.cmd, that contains only the following...
net stop wmpnetworksvc
sysprep /generalize /oobe /shutdown /unattend:unattend_x64.xml


I stumbled across a few posts where they found that the Windows Media Player sharing service can ruin Sysprep, so I start by stopping the service. Then I launch Sysprep, calling the answer-file.

The answer-file was the hard part.
The answer-file below is for x64 only. To tailor it for x86, simply replace processorArchitecture="amd64" with processorArchitecture="x86".

The unattend_x64.xml answer-file

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="NonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SystemLocale>en-us</SystemLocale>
<UserLocale>en-us</UserLocale>
<UILanguage>en-US</UILanguage>
<UILanguageFallback>en-us</UILanguageFallback>
<InputLocale>0409:00000409</InputLocale>
</component>
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="NonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UserData>
<ProductKey>
<Key><span style="font-weight:bold;">XXXXX-YOUR-WIN7X-KEYXX-XXXXX</span></Key>
<WillShowUI>OnError</WillShowUI>
<!-- <WillShowUI>Never</WillShowUI> -->
</ProductKey>
<Organization>Loose Screw</Organization>
<FullName>Administrator</FullName>
<AcceptEula>true</AcceptEula>
</UserData>
</component>
</settings>
<settings pass="oobeSystem">
<component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Reseal>
<Mode>OOBE</Mode>
</Reseal>
</component>
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" 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>
<ProtectYourPC>1</ProtectYourPC>
<NetworkLocation>Work</NetworkLocation>
<HideEULAPage>true</HideEULAPage>
</OOBE>
<TimeZone>Mountain Standard Time</TimeZone>
<AutoLogon>
<Password>
<Value>h@rdpa$$w0rd</Value>
<PlainText>true</PlainText>
</Password>
<Username>Administrator</Username>
<Enabled>true</Enabled>
<LogonCount>5</LogonCount>
</AutoLogon>
<UserAccounts>
<AdministratorPassword>
<Value>h@rdpa$$w0rd</Value>
<PlainText>true</PlainText>
</AdministratorPassword>
<LocalAccounts>
<LocalAccount wcm:action="add">
<Password>
<Value>PASSWORD HERE</Value>
<PlainText>true</PlainText>
</Password>
<Name>PC Central</Name>
<Description>Local Administrator</Description>
<DisplayName>IT Central</DisplayName>
<Group>Administrators</Group>
</LocalAccount>
</LocalAccounts>
</UserAccounts>
<OEMInformation>
<Manufacturer>Dell</Manufacturer>
<HelpCustomized>false</HelpCustomized>
<SupportURL>http://support.dell.com/support/index.aspx?c=us&cs=04&l=en&s=slg</SupportURL>
</OEMInformation>
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<Description>Activate Windows 7</Description>
<CommandLine>"cscript C:WindowsSystem32slmgr.vbs -ato"</CommandLine>
<Order>1</Order>
</SynchronousCommand>
</FirstLogonCommands>
</component>
<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" 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>
<UILanguageFallback>en-us</UILanguageFallback>
<UserLocale>en-us</UserLocale>
</component>
</settings>
<cpi:offlineImage cpi:source="wim://SERVER1/install.wim#Windows 7 ENTERPRISE" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>