Windows 7 Deployment with Sysprep
Compared to [wikipop]Windows XP[/wikipop], deployment of [wikipop]Windows 7[/wikipop] has been much simplified. You know in XP, when it asks if it can connect to Windows Update to get drivers? Yeah, that actually does stuff in 7. Dealing with changing [wikipop search="Hardware abstraction layer"]HAL[/wikipop]‘s is also no longer a problem in 7.[toc class="toc-right"]
7 handles deployment quite gracefully. We can literally just run Sysprep and deploy the image, and 7 will figure it out. Now, this isn’t the most effective way to Sysprep a machine, but if you need a quick image for something and you don’t mind sitting through the setup process, it works. Just like my article for XP, I want to say that I don’t know if the methods here are the “right” way to go about [wikipop search="Sysprep"]sysprep[/wikipop]-ing machines, but it works, and I think that’s what counts.
Sysprep is located in C:\Windows\System32\Sysprep by default (yes, it actually just comes with the OS). Just run it as Administrator, select Enter System Out-of-Box Experience(OOBE) and check Generalize. After the machine shuts down, take an image and deploy it.
You’ll then be taken through the normal setup routine (setting up an administrator, license key, etc). If the machine is connected to the Internet, 7 will try to find updates and proper drivers.
Deployment Using Windows System Image Manager (WSIM)
If you plan on deploying Windows 7, you definitely need to create an unattended installation answer file. Unlike XP, where the answer file was just a text file with some fields, 7’s is a more complicated [wikipop]XML[/wikipop] file. Microsoft has put out some tools to aid in the creation of these files, namely the Windows System Image Manager. This is part of the Windows Automated Installation Kit (AIK), a rather hefty download (1.6 GB iso), but something you need.
Once you’ve downloaded and installed the kit, you need to grab some files from your Windows 7 installation disk. Explore the disk, go to the sources folder, and look for a file called install.wim, it’s about 2.5 GB in size. Copy that to your computer somewhere (I put mine in C:\Sysprep, but it doesn’t really matter where you put it). Now go ahead and open the Windows System Image Manager.
It looks kind of ugly, but once you get used to it it’s not bad. The window is split into a few different sections, we only need the Windows Image, Answer File, and Properties sections. Right click where it says Create or Open an Answer File and hit New Answer File.
So now we have a blank answer file. The seven different options under the Components section correspond to the different passes that Sysprep makes. I’m not going into too much detail now; you don’t need to know a whole lot about the passes in order to get this to work. So for now, right-click where it says Select a Windows image or catalog file and clickSelect. Go to the install.wim file you copied earlier, and hit Open. It will probably tell you that it can’t find the catalog file, and ask if you’d like to make one; click Yes. This will “take a few minutes.”
Now you should see a tree with two options, Components and Packages. Expand the Components and you’ll see a long list of odd names. These components are the possible settings you can add to your answer file. Yeah, it’s weird. Anyway, if you highlight a component, the Properties pane will show you some of the available settings. You can then highlight a setting, and you’ll get a little more information; usually it just shows you the type of setting it is (boolean, string, etc), but it will warn you if a setting has been deprecated.
WSIM Properties Pane
Right click on a component and you’ll see Add Setting to Pass… 1 through 7, corresponding to the seven passes in the answer file. Some of them are grayed out, but more often than not you’ve got more than one choice. How do you figure out which to choose? Well, it depends on what you want it to do. For instance, putting amd64_Microsoft-Windows-Shell-Setup into pass 4 gives me different settings than if I put it into pass 7.
That’s the basics of WSIM. Microsoft’s TechNet has a more in-depth information about it if you’re interested.
Alright, so what are the Passes?
There are seven configuration passes: WindowsPE, offlineServicing, generalize, specialize, auditSystem,auditUser, and oobeSystem. Each is designed to take care of different parts of the setup process. Microsoft has a nice little table to explain what they do, go ahead and skim through it if you want. What we really need to know is this:
Generalize runs when we run Sysprep /generalize
Specialize runs on the next boot after running /generalize
AuditSystem and AuditUser run when we run Sysprep /audit
WindowsPE runs when Windows PE boots (it’s the setup environment, like what you’d see when you’re first installing Windows)
Making Sense of the Components
You’ve probably noticed that all of the components have very similar names. They all begin with AMD64, x86, or wow64, then Microsoft-Windows, and THEN the name of whatever the component controls. The beginning specifies the architecture that the component is designed for; AMD64 is for 64 bit machines (both Intel and AMD) and x86 is for any 32 bit hardware. [wikipop]WoW64[/wikipop] is short of Windows-on-Windows 64, it’s a subsystem that runs 32 bit programs on 64 bit OS’s (I’m not really sure when their use would ever be needed).
Most of the components have multiple versions, one for each architecture, so make sure to choose the right ones. For this article, I’m using only AMD64 components, but the 32 bit ones are very similar.
Okay, Now Let’s Make an Answer File
So once you’re familiar with using WSIM, all that’s left to do is build the answer file by adding the components you wish to add.
Building a Basic Answer File
To create a basic unattended installation answer file, we need two components: amd64_Microsoft-Windows-International-Core_neutral and amd64_Microsoft-Windows-Shell-Setup_neutral. The two of these take care of the basic questions during setup. Add International-Core_neutral to pass 7, and Shell-Setup_neutral to both 4 and 7.
In Shell-Setup_neutral for pass 4, set:
- Computer Name: * (this is a wildcard, it will create a random computer name)
- Copy Profile: false (this doesn’t work the way that we want it to, so set it to false)
- Time Zone: full name of your time zone (ie Central Standard Time, Saint Pierre and Miquelon Standard Time)
Leave RegisteredOrganization and RegisteredOwner alone, we’ll change those in Pass 7 ((some even claim that you MUST leave these at their default values of “Microsoft” and “AutoBVT”. ))
In Pass 7, you can change the RegisteredOrganization and RegisteredOwner settings. Also notice that you can expand this component in Pass 7, and you’ll see a sub-component named OOBE. Here, you can set:
- HideEULAPage: true
- HideWirelessSetupInOOBE: true
- NetworkLocation: Work/Home/Other
- ProtectYourPC: 1,2, or 3
Do NOT set SkipMachineOOBE or SkipUserOOBE. SkipMachineOOBE is for “testing purposes only”, and SkipUserOOBE is deprecated; SkipUserOOBE is referring to the sort of Welcome screen that you’d typically get in previous versions of Windows the first time you log in, but there isn’t anything of the sort in Windows 7, so that setting doesn’t do anything.
On the ProtectYourPC setting, you can set it to be 1,2, or 3. When running setup, you’re asked to choose what sorts of updates you want your computer to automatically download. 1 is equivalent to the recommended setting (all updates), 2is only important updates, and 3 is none.
For International-Core_neutral, there are five settings:
- InputLocale: Specifies the system input locale and the keyboard layout
- SystemLocale: Specifies the language for non-Unicode programs
- UILanguage: Specifies the system default user interface (UI) language
- UILanguageFallback: Specifies the fallback language if the system default UI language is only partially localized
- UserLocale: Specifies the per-user settings used for formatting dates, times, currency and numbers
The values are a string that specifies language and country. The naming scheme follows ISO 639-1 (language codes) andISO 3166-1 (country code) standards. For example, if you want everything to be in English and you’re in the United States, you’d use en-us. And if you live at the Vatican and speak Esperanto, it’d be eo-va.
Once all this is added, your answer file should look something like this:
- Answer File
At this point, you could save the file to your Sysprep directory, and run Sysprep by going to commandline and typing:
cd C:\Sysprep Sysprep /generalize /unattend:<unattendfilename>
Once the machine shuts down, take an image, and it’s ready to deploy.
Adding Other Components
Those two components are really all you need to get the unattended installation process rolling, but Sysprep allows for much greater customization during setup. Looking at the components list, if we expand Shell-Setup_neutral, you’ll notice there are a ton of extra sub-components that weren’t listed in the answer file. To add them, just right click and choose what pass you want them in. For example, you can create new user accounts during setup, run logon commands, set display settings, etc.
There are tons of different components, and what each does isn’t very obvious in WSIM. As of writing this, Microsoft doesn’t have a breakdown of the components on their website for 7, but they do have one for Vista. Unless something has been deprecated, it should behave pretty similarly to how it did in Vista’s unattended setup, so it’s a good resource for figuring out how a component works.
Add Device Drivers
Adding new device drivers is now a lot easier than in XP. First, get all the drivers you’ll need all nice and organized somewhere you can get to easily. At the top of WSIM, click Insert, then Driver Path. Choose Pass 5 AuditSystem, because we can’t run the WinPE or offlineServicing passes in Sysprep. Select the folder that you’ve got all of your drivers in, and a new component will be added to the AuditSystem pass: PnpCustomizationsNonWinPE_neutral. Expand the component down to the Credentials sub-component, and provide a user name and password that has access to your drivers folder.
Note that if you do this, you must run Sysprep /Audit /Unattend:<filename> to run the AuditSystem pass. Once this is done, you then need to run Sysprep /OOBE /Unattend:<filename> to perform the remaining passes.
Other Things That Are Worth Noting
Creating Default User Profile
To change the Default User profile, you’ve basically got to manually replace the folder. However, using the Copy To… button in the User Profiles doesn’t work as it did in XP and Vista. The Copy Profile setting in the answer file doesn’t work either.
To get around this problem, first, get your profile setup the way you like it then go to C:\Users. Make a copy of the current Default folder (name it Default.back or something). ((If you do not see a Default folder, you may have to Show Hidden files/folders in Windows Explorer options)) Next, delete the Default folder and rename the profile you just setup to Default.
To test it simply login with another account to be certain that you get the settings you expect. If it doesn’t have the same settings as the one you setup, there might be a permissions error with the new Default folder.
If you get a message such as ‘You have been logged in with a temporary profile’ then it is likely because you are attempting to log on to a profile that wasn’t properly removed. This article for clearing profiles from registry (for Vista, but don’t let that shake you) did the trick for me.
One thing you’ll probably notice is that the desktop background changes when you do this. This is because by default, the background image is stored in a C:\Users\<profilename>\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper.jpg, and for whatever reason, this doesn’t seem to get copied over.
If you want to persist the same background across all new profiles, you just need to change one registry setting: HKEY_CURRENT_USER\Control Panel\Desktop\Wallpaper. Just put your background image somewhere that it won’t be messed with, and point that setting to the new picture. Then, of course, copy this profile back over the Default profile again.
Customize the Login Background
Windows 7 allows you to change the login background without the need to use third-party software like Vista (or maybe I just never figured it out?).
Go to %windir%\System32\oobe. Create a new folder called info. Then, inside info, create a new folder called backgrounds. Inside this folder, you can put your images, at least one named backgroundDefault.jpg. You can add others, named background<resolution>.jpg For instance, I have background1280x1024.jpg and background1680x1050.jpg. Windows will automatically pick the proper image, depending on the screen resolution. If it doesn’t find an appropriate one, it will default to backgroundDefault.
Now, go back to \oobe. Notice there is another background.bmp here. We need to change this too, but it’s considered a system file, so we’ve got take ownership of it first. Type cmd into the Start menu search box, and press Ctrl+ Shift+Enter to open an Administrator command prompt.
Now, type takeown /f c:\Windows\system32\oobe\background.bmp
If it gives you a Success! message, then you’ve got control of the file. However, you still must change the permissions to allow yourself access to the file. Once that’s done, rename the file something else, and then create a new background.bmpwith your login background.
Finally, there’s one Registry key to change: HKLM\Software\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background\OEMBackground. Set its value to 1, and that’s it.
TechNet: Windows 7 Desktop Deployment – a lot of articles about various aspects of Windows 7 deployment. Not the most user friendly setup, but the information is good.
Trackback from your site.