1.4 Sysprep
Sysprep is a tool in the
%SystemRoot%\System32\Sysprep folder of every
Windows installation since Windows Vista. The purpose of Sysprep is
to generalize a model computer installation image so that it can be
used on many other computers. Sysprep achieves this generalization
by removing only those settings of the model installation that
should not be shared by other computers—settings such as the
computer name, its domain membership, the time zone, the product
key, the security identifier (SID), and various other user and
machine settings. When you run Sysprep on an installation of
Windows, a Sysprep image is generated, and the installation is said
to be Sysprepped.
After you run Sysprep, the computer shuts down. The Sysprepped installation then resides on the hard disk,
ready to be captured by ImageX or Windows Deployment Services into a WIM file and
deployed to other computers.
The settings removed by Sysprep need to be replaced on each
computer that uses the Sysprepped image. Some of these settings
(such as the computer SID) are automatically regenerated when the
installation starts for the first time after Sysprep has run. Other
settings might be provided by an answer file you configure in
advance and supply when the Sysprepped image first starts. All
remaining settings the system needs are provided by the user in an
interactive wizard that appears during the first restart after
Sysprep is run.
1.5 Deployment Image Servicing and Management (Dism.exe)
Dism is a command-line utility that is new in Windows 7 and
Windows Server 2008 R2. It enables you to modify Windows images before deployment. With Dism, you can
mount an image offline and then add, remove, update, or list the
features, packages, drivers, or international settings stored on
that image. You can also use certain Dism commands to service an
online image—in other words, the current (active) operating system.
As a utility, Dism consolidates and replaces the features of PEimg,
Intlcfg, and Package Manager, which were available on earlier
versions of Windows AIK.
Dism is a powerful utility with many functions and options.
The following list presents some of its main uses:
-
Mount, unmount, or get information about a Windows image
You can use /Mount-Wim to mount a Windows image in the Windows
file structure. After it is mounted, you can make changes to the
image. For example, the following command mounts the first image
within a WIM file named install.wim in the C:\test\offline
directory.
Dism /Mount-Wim /WimFile:C:\test\images\install.wim /index:1 /MountDir:C:\testoffline
After servicing an image, you might want to save any
changes you have made while the file is still mounted in the
file structure. To do so, use /Commit-Wim. For example, the following command
commits changes made to the image mounted in
C:\test\offline.
Dism /Commit-Wim /MountDir:C:\test\offline
To unmount an image, use /Unmount-Wim. You can also specify the /Commit or
/Discard argument to save or discard unsaved changes made to the
image when it was mounted. The following example unmounts the
file mounted in C:\test\offline and commits any changes made
since the image was last saved.
Dism /Unmount-Wim /MountDir:C:\test\offline /commit
To get information about an image or WIM file, use
/Get-WimInfo. The following example gets information about the
first image in a file named install.wim.
Dism /Get-WimInfo /WimFile:C:\test\offline\install.wim /index:1
-
Add a package to or remove a package from an image
Packages are .cab files that can be installed into a Windows
image and that add feature sets to that image. If you have installed
Windows AIK, you can find many such packages built for Windows
PE images in the C:\Program Files\Windows
AIK\Tools\PETools\amd64\WinPE_FPs\ folder. Packages in this
folder include WinPE-WMI.cab, which enables some system
diagnostics for a Windows PE image through the Windows
Management Instrumentation interface, and WinPE-WDS-Tools, which
adds Windows Deployment Services tools to the image.
To add a package, use /AddPackage. For example, the following command
adds the Package1.cab package to the image mounted in
C:\test\offline.
Dism /image:C:\test\offline /Add-Package /PackagePath:C:\packages\package1.cab
To remove a package, use /RemovePackage. For example, the following command
removes the Package1.cab package from the image mounted in
C:\test\offline:
Dism /image:C:\test\offline /Remove-Package /PackagePath:C:\packages\package1.cab
-
Add or remove a device driver
You can use the Dism command with the /Add-Driver option to
add third-party device drivers to a Windows image. When you use the /Driver option to
point to a folder, INF files that are not valid driver packages are ignored. If you
point to a path and use /Recurse, all subfolders are queried for drivers to add. For example,
the following command adds all the drivers found in the C:\test\drivers directory
and its subdirectories to the image mounted in C:\test\offline. Invalid driver
packages will be ignored.
Dism /image:C:\test\offline /Add-Driver /driver:C:\test\drivers /recurse
To remove a third-party device driver, use /Remove-Driver. When they are added to an image,
third-party device drivers are named Oem0.inf, Oem1.inf, and
so on. To remove a third-party driver, you must specify such a
name. For example, the following command removes the second
third-party driver added to the system:
Dism /image:C:\test\offline /Remove-Driver /driver:oem1.inf
-
Modify international settings
You can use /Set-UILang with the Dism
command to set the default user interface language. The language
must also be installed in the Windows image, or this command
will fail. Use the following command, for example, to set the
default user interface language to French on the image mounted
in C:\test\offline.
Dism /image:C:\test\offline /Set-UILang:fr-FR