Вы находитесь на странице: 1из 14

Sysprep a Windows 7 Machine Start to Finish V2 This article can also be read at my new website: http://www.theitbros.com.

. SPREAD THE WORD, TOGETHER WE HAVE CONQUERED SYSPREP This is version 2 of a step by step guide on Sysprepping a Windows 7 machine from start to finish. I cannot take full credit on this because my first article had so many helpful comments and discussions that this is simply a combination of all the good advice written into a working guide. (I would especially like to thank George for his input on Cscript for auto activation and Nathan for input on Sysprep Audit Mode). This will guide you through the following: - Audit Mode - Building the unattend.xml file in WSIM -copyprofile=true command to copy the default profile (no manual copy) - Prompt for a computer name - Enable Administrator account - Administrator account logs in first time automatically - Activate windows automatically with Cscript; - Successfully copy over taskbar icons; - Delete unattend.xml file automatically upon completion of re-image. Here is a list of what you will need: - Latest version of WAIK : KB3AIK_EN.iso Version 1.0 - Windows Vista or Windows 7 Machine to build the XML file on - ISO or DVD of Windows 7 Installation (x32 or x64) - WinPE Boot Environment : BrianLeeJackson WinPE 3.0 BootLoader First we are going to walk through building the unattend.xml file (answer file) and then we will walk through the actual Windows 7 imaging process. Step #1 If you have a Windows 7 installation DVD, insert it now. Or if you have an ISO of 7, go ahead and extract it to a folder on your desktop. (I recommend 7-zip). Step #2 Launch Windows System Image Manager. Your start menu should look like the image below:

Windows 7 WAIK Version 1 Step #3 Under the Windows Image header, right click and select new image.

Windows System Image Manager Step #4 You will now want to browse to the .CLG file in your Windows 7 installation (I am using Windows 7 Enterprise x64 in my example). It is located in the sources folder. See Image below. You can select either the .clg file or the install.wim. Both will have the same result.

Selecting CLG File - WSIM Step #5 Now we need to create a new answer file. Go to the file menu and select Create New Answer File. Right after creating one, go ahead and simply go to file menu and select Save Answer File. This will give your XML file a name and save location. I chose to name mine unattend.xml. Now you see we have two category folders, Components and Packages. Under the Components folder you see that we have 7 options: -1 windowsPE -2 offlineServicing -3 generalize -4 specialize -5 auditSystem -6 auditUser -7 oobeSystem Step #6 These are very important as these are the steps in which the unattend.xml file is sequenced. The next part is a little confusing. You are going to add components, from under the Windows

Image section on the bottom left hand side to the passes on your Answer File. To add a component, you can right click on them and select add to # pass. There are many different options you can add, but they have to be done in a certain order and pass otherwise your sysprep might fail. I am simply going to use the one I created as the example.

Answer File - Unattend.xml Here is more information about adding options under the passes: 1 windowsPE Nothing required in my example. 2 offlineServicing Nothing required in my example. 3 generalize

amd64_Microsoft-Windows-Security-SPP_6.1.7600.16385_neutral Set 1 for SkipRearm to allow up to 8 rearms 4 specialize amd64_Microsoft-Windows-Deployment_6.1.7600.16385_neutral 1. 1. Order: 1 path: net user administrator /active:yes WillReboot: Never 2. RunSynchronousCommand[Order="1"] RunSynchronous amd64_Microsoft-Windows-Security-SPP-UX_6.1.7600.16385_neutral SkipAutoActivation: true amd64_Microsoft-Windows-Shell-Setup_6.1.7600.16385_neutral Computer Name: Leave blank (we will deal with this at the end) CopyProfile: true Registered Organization: Microsoft (you must leave this in this section) Registered Owner: AutoBVT (you must leave this in this section) ShowWindowsLive: false TimeZone: Pacific Standard Time (Please view TimeZone settings here ->http://technet.microsoft.com/enus/library/cc749073%28WS.10%29.aspx) You can delete other sub-header components if you dont need them. 5 auditSystem Nothing required in my example. 6 auditUser Nothing required in my example. 7 oobeSystem

amd64_Microsoft-Windows-International-Core_6.1.7600.16385_neutral InputLocale: en-us SystemLocale: en-us UILanguage: en-us UserLocale: en-us amd64_Microsoft-Windows-Shell-Setup_6.1.7600.16385_neutral RegisteredOrganization: Your Company Name RegisteredOwner: Your Name yAutoLogon 1. Password: Administrator Password Enabled: true LogonCount: 5 Username: administrator yFirstLogonCommands 1. CommandLine:cscript //b c:\windows\system32\slmgr.vbs /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX (windows 7 license key) Order 1 RequiresUserInput: false CommandLine:cscript //b c:\windows\system32\slmgr.vbs /ato Order 2 RequiresUserInput: false SynchronousCommand[Order="1"] SynchronousCommand[Order="2"] yOOBE HideEULAPage: true NetworkLocation: Home ProtectYourPC: 1 yUserAccounts

1. 1. 1. Password: Administrator Password 2. Action: AddListItem Description: Local Administrator DisplayName: Administrator Group: Administrators Name: Administrator 2. LocalAccount[Name="Administrator"] AdministratorPassword: Administrator Password LocalAccounts If you have questions, look at my image above to see full layout of components, it should help. Step #7 K, now go ahead and save your answer file as unattend.xml. Step #8 If you want the sysprep to prompt for a computer name you need to remove a line from your XML file. Open up your XML file you saved with notepad and remove the following line:

Unattend.xml Computer Name Step #9 Install Windows 7 (Enterprise) from CD or USB flash drive, when you arrive at the welcome screen and it asks you to create a username, hit ctrl+shift+f3. This will reboot your machine and put your windows build in audit mode. Step #10 On reboot, youll automatically be logged in under the built-in Administrator account. A sysprep GUI box will appear, but you can close it and NOW begin to customize your profile.

Step #11 Install any software/drivers, make any profile customizations, etc. If you need to reboot, the computer will boot you back into the Administrator account. You will be stuck in this audit mode until you run sysprep with the /oobe parameter. After doing so, sysprep will delete/clean up the Administrator account, but if you have copyprofile=true in your unattended answer file, it will copy the customized Admin account to the default profile before deleting it. Step #12 On the PC you are going to be running sysprep on, you need to create a folder called scripts in this directory: %WINDIR%\Setup\. Now you are going to create a CMD file within the %WINDIR%\Setup\Scripts directory. Right click and make a new text file called SetupComplete.txt. Remove the .txt extension and replace that with .cmd. You now have a SetupComplete.cmd file which windows will read the first time it boots up from the sysprep. We need to place a script inside the CMD file. Edit the cmd file with notepad and insert this line: del /Q /F c:\windows\system32\sysprep\unattend.xml. This script will delete your unattend.xml file after it has been used. The unattend.xml file is also copied to the C:\Windows\Panther directory, so you will want to add a second line to the CMD file, del /Q /F c:\windows\panther\unattend.xml. If you have passwords or cd keys stored in that xml file you dont have to worry about it being left on the computer. UPDATE AS OF JUNE 16TH: Read my Taskbar Icons Tutorial before continuing. Step #13 Once you have everything configured correctly, Copy or move your unattend.xml file to : C:\windows\system32\sysprep. Now to run sysprep, navigate to that sysprep folder, hold SHIFT and right click and select Open New Command Windows Here. Next, input the following commands: sysprep /generalize /oobe /shutdown /unattend:unattend.xml Step #14 Turn the computer back on and boot to WinPE 3.0 environment (USB stick or CD/DVD). You can use my BrianLeeJackson WinPE3.0 BootLoader to boot up from USB or CD and capture your image. Capture image and save image to network location. A Dell 960 or GX755 is a good standard for capturing when you want a generic image for use with multiple systems. Might require injecting additional drivers for 3rd party brands, HP, etc. Most should work though right out of the box. Step #15

On reboot, Windows will run out of the box, as the /oobe is intended. As long as you put your cd key into the unattend.xml file, windows will be activated automatically in the background, you will be automatically logged into the administrator account, and the unattend.xml file is deleted. You are now ready to use the computer or join it to the domain. Enjoy! Share and Enjoy:

MySysprep 2 for Windows Vista / Windows Server 2008 / Windows 7 / Windows Server 2008 R2
Introduction
MySysprep is a tool to extend the functionality of SYSPREP.EXE, that is provided in Windows Operating System for creating a standard image to be deployed in an organization. MySysprep for Windows XP has been used in many organizations all over the world to simplify image preparation and deployment. MySysprep 2 is designed for Windows Vista and Windows Server 2008.

Sysprep for Unattended Deployment


In Windows Vista, an unattended answer file is stored as an XML file. You have to use the command argument /unattend: to specify your answer file. The common used command for Sysprep is
Sysprep /generalize /oobe /shutdown /unattend:c:\sysprep.xml

Where c:\sysprep.xml is your answer file, which can be any directory in your local drive. To use MySysprep, you simply put MYSYSPREP.EXE in the same directory as SYSPREP.EXE in C:\Windows\System32\Sysprep, and use MYSYSPREP.EXE instead of SYSPREP.EXE. For example
MySysprep /generalize /oobe /shutdown /unattend:c:\sysprep.xml

Auto Computer Name


Computer name is configured in Microsoft-Windows-Shell-Setup component during specialize pass. Sysprep only allows users to use a fix or a random name. With MySysprep, you can compose a computer name by using manufacturer, model, serial number and asset tag from SMBIOS, or even prompt a dialog for user input. Most of users would use the following configuration to let Windows generate a random computer name, and rename it after setup is completed.
<settings pass="specialize"> <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>*</ComputerName> </component> </settings>

With MySysprep, you can use the four variables %Manufacturer%, %Model%, %SerialNo%, and %AssetTag% to compose a computer name. For example,
<ComputerName>%SerialNo%-%AssetTag%</ComputerName>

You can also take substring from any variable by appending (StartIndex, Length)before the closing percentage. The character index is zero-based. For example,
<ComputerName>%SerialNo(0,4)%-%AssetTag(2,4)%</ComputerName>

You can also take substring from the end of any variable by giving a negative value as StartIndex. The last character is -1, and the one before the last character is -2 and so on. For example,
<ComputerName>%SerialNo(-1,4)%-%AssetTag(-2,4)%</ComputerName>

If you use a variable that is not pre-defined, it will pop up a dialog asking for user input during setup. For example,
<ComputerName>%Please input a computer name%</ComputerName>

However, because of the limitation of NetBIOS, if the computer name you compose is longer than 15 characters, you will get an error during specialize pass and the deployment will fail. To find out the manufacturer, model, serial number, and asset tag of a computer, you can use the following command.
MySysprep /smbios

Prompt for User Input

In fact, any configuration value in an unattended XML can be configured to prompt for user input. For example,
<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> <Credentials> <Domain>%Please input user domain%</Domain> <Username>%Please input user name%</Username> <Password>%Please input user password%</Password> </Credentials> <JoinDomain>%Please input a domain to join%</JoinDomain> </Identification> </component>

During setup, it will pop up a dialog asking users for Domain, Username, Password, and JoinDomain. You can even let it show a list of options in a combo box. For example,
<JoinDomain>%Please select a domain to join{Corp;Lab1;Lab2}%</JoinDomain>

The options are enclosed by curly brackets and each one is separated by semicolons. In this example, the combo box will show three options: Corp, Lab1, and Lab2 for a multi-domain environment. Users can select a domain to join instead of typing the domain name. To have an input box with a default value, use only one option inside curly brackets. For example, if you want the asset tag as the default computer name, but you want to have the chance to override it during setup. You can have the following configuration.
<ComputerName>%Please input a computer name{%AssetTag%}%</ComputerName>

During setup, you can click OK to accept the default computer name or update it. You can take a substring of a variable or compose a string inside curly brackets. For example,
<ComputerName>%Please input a computer name{CORP%SerialNo(0,4)%%AssetTag(0,4)%}%</ComputerName>

Another feature is designed specially for password fields. If you put the attribute [password] right after the first % mark, the dialog will mask user input and the user needs to type the password twice to confirm. For example,
<Password>%[password]Please input Admin password%</Password>

Image Debugging
During setup if your image failed at specialize pass, it is difficult to retrieve logs and check system state to find out what's wrong. With MySysprep, you can open a command prompt during setup, and run notepad, regedit, or other applications that don't require Windows shell to debug image problems. To open a command prompt during setup, simply press Ctrl+Shift and then double-click on the MySysprep logo. The difference between this command prompt and the one opened by using Shift+F10 is that this command prompt will block setup going to the next stage. You have the chance to debug during the blockage. Then you have to exit the command prompt to continue setup..5 for x64

Download
Version 2.0.0.5 for x86. Version 2.0.0.5 for x64

Support
If you are interested in a customized version of MySysprep, please contact mysysprep@tsaysoft.com Some requested customizations:
y y y

Logo removal Customized logo Auto computer name from a text file in a non-system drive.

y y y y

Auto computer name looked up from a mapping table User input validation Customization of user input dialogs Script friendly to generate/modify unattended XML files

Вам также может понравиться