Welcome to shell: revealed Sign in | Join | Help
in Search

Shell Blog

Part 3 Dr. Unattend: Sysprep and ImageX or how to capture an image by its toe

In previous episodes of Dr. Unattend, you learned how Windows Vista's setup can be automated using unattend answer files. You also learned how to create and validate a simple unattend answer file using Windows System Image Manager (WSIM) that pumps support information into the System Control Panel.

Now you must be wondering: “This is great, I can use an unattend answer file to launch a ‘clean install’ that automates different parts of setup. But what if I already have an installation of Windows Vista that I have customized? Can I capture the image so it can be deployed on any PC?”

Yes! Smile

This is possible using two great tools: sysprep and ImageX. According to the Windows Administrative Installation Kit (WAIK) documentation, “The System Preparation (Sysprep) tool prepares an installation of Windows for duplication, auditing, and customer delivery. Duplication, also called imaging, [using ImageX in this case] enables you to capture a customized Windows image that you can reuse throughout an organization.”

So in other words, sysprep can ‘generalize’ a system by removing machine-specific information, files and registry settings from it. Of course, the first thing that happens after a computer is generalized and reboots is that setup kicks off the ‘specialize’ pass that puts all the machine-specific information back in! If you could capture the image of the hard-disk right before specialize pass of setup happens, you would have an image that could be deployed on almost any computer. Here's a hint: what's uber-cool about sysprep is that not only can it instantiate several different passes of setup, it can also pass an unattend answer file to setup. Try out sysprep /? for more information.

NOTE: Running sysprep clears away machine-specific information from your PC. For example, it forces Windows Welcome to start again and it also unjoins a PC from a domain. Make sure you read about sysprep in the WAIK before trying these steps:

1. Lets assume you have a deployment share called \\deployment on a PC other than the one being imaged. Underneath this share, create two folders: bin and images. In the bin folder, copy ImageX binaries from C:\Program Files\Windows AIK\Tools\x86. Make sure you have read access to the bin folder and read-write access to the images folder. The images folder should ideally have 10 GB of free space to accommodate a large image.
2. On the PC to be imaged, click Start
3. Type cmd and press CTRL+SHIFT+ENTER to launch an elevated command prompt
4. Type cd %windir%\system32\sysprep and press ENTER
5. Type sysprep /generalize /oobe /reboot and press ENTER
6. When the PC reboots, boot into Windows PE. For example, if you are connected to a WDS server, press F12 on boot and shows ‘Windows PE’ as the boot option. You can also boot to Windows PE from a Windows PE DVD.
7. Type net use * \\deployment and press ENTER. Lets say the share is now mapped to drive Z:
8. Type imagex /capture c: z:\images\install.wim "Drive C" /verify and press ENTER. Imaging may take a couple of hours depending on how many files are on the source drive.

Here's an overview of the workflow:

 

Now you can deploy this image to any computer, either by using imagex /apply or by using an unattend answer file to point setup to this image! In the next installment of Dr. Unattend, we'll visit another favorite tool of mine - Package Manager.

Published Wednesday, October 18, 2006 12:28 PM by baslam
Filed under: , , ,

Comments

 

Steve Maser said:

When we've tried sysprep with all the recent Vista builds (including RC2), we're finding that it's *not* respecting certain parts of an "unattend.xml" file.  Specifically:

<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>

<ProtectYourPC>1</ProtectYourPC> (***WAS "3" but is now "1"***)

<SkipMachineOOBE>true</SkipMachineOOBE>

<NetworkLocation>Work</NetworkLocation> (***ADDED THIS***)

<SkipUserOOBE>true</SkipUserOOBE>

</OOBE>

</component>

No matter what settings we use for "ProtectYourPC" or "NetworkLocation", after running sysprep and rebooting the computer will do two things after we log back in:

1)  Ask us to "set network location" again.

2)  Inform us that Automatic Updates for Windows is not enabled.

Is this a known issue that will be fixed in the RTM build?   We can reproduce this ever time on multiple machines.

October 19, 2006 1:03 PM
 

Karim said:

Awesome stuff.  Man, if I'd had WIM and imagex years ago... *sigh*

I guess I can toss my Ghost CDs now?  No wonder Symantec hates Microsoft.  LOL

October 20, 2006 5:59 PM
 

baslam said:

Steve, if SkipMachineOOBE = true, then NetworkLocation and ProtectYourPC settings do not get processed. SkipMachineOOBE is a deprecated setting, and it was meant for testing only.  I would recommend setting SkipMachineOOBE = false, and referring to a topic in the WAIK (I believe it's called 'Settings for Windows Welcome') on the right way to turn off pages of Windows Welcome. I also encourage you to think about whether turning off pages of Windows Welcome is the right user experience - many users like being able to personalize the computer before starting to use it. This is why we provide a short wizard-like experience that can help you perform necessary tasks to your liking before logging in for the first time.

Also, there is a known issue with the NetworkLocation unattend setting - while we investigate it, can you please try this workaround:

Continue to use the NetworkLocation unattend setting. In addition, set the value of this regkey HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork\Category to 0 for home/work or 1 for public.

November 3, 2006 12:26 PM
 

Shell Blog said:

As you might have guessed in my last three posts ( 1 , 2 , 3 ), I love Windows deployment. It&rsquo;s

November 6, 2006 5:42 PM
 

simplifyit said:

Has this "known issue with the NetworkLocation unattend setting" been resolved yet?  I am still finding this with RTM versions of both Vista, WAIK and OPK.

Would appreciate a response on this.  Also what is the best suggested methof for adding the registry setting (Continue to use the NetworkLocation unattend setting. In addition, set the value of this regkey HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork\Category to 0 for home/work or 1 for public.) during an unattended installation or after sysprep /oobe /generalize ?

Cheers,

Darren

December 11, 2006 5:36 AM
 

Steve Maser said:

Is there a similar workaround for setting "automatic updates" to be turned on if you use "skipmachineoobe"?

It's the last step I need in my custom unattend.xml file...

Please?

February 9, 2007 11:16 AM
Anonymous comments are disabled

About baslam

I am Shell's deployment Program Manager. I love going for walks with my wife and two Shiba Inus, Leo and Maja. One of my dogs wrote this bio.
Powered by Community Server, by Telligent Systems © 2006 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement.