Understanding Windows images
In earlier versions of the Windows Server operating system, such as Windows NT 4.0 and
Windows Server 2003, all the files needed to install the operating system were located in a special i386 directory on the installation media. With Windows images, the entire operating system—as well as associated drivers, updates, and applications—is stored within a single image. During installation, this image is applied to the target volume. Windows images use the Windows Imaging (WIM) file format and have the following benefits:
- Multiple deployment methods You can use a variety of ways to deploy Windows images. You can deploy .wim files using a traditional DVD-ROM, from a bootable USB drive, from a network share, or through specialized deployment technologies such as Windows Deployment Services (WDS) or Microsoft System Center 2012 Configuration Manager.
- Editable You can mount an image and edit it, enabling, disabling, or removing operating system roles and features as necessary.
- Updatable You can update an image without having to perform an operating system image capture. In previous versions of Windows, you had to perform a deployment, apply updates, and then capture a new image. If you wanted to update that image, you’d have to start from scratch.
The Windows Server 2012 installation media contain two .wim files in the Sources directory: Boot.wim and Install.wim. Boot.wim is used by the installation media to load the preinstallation environment that you use to deploy Windows Server 2012. Install.wim stores one or more operating system images.
Available with the evaluation version of Windows Server 2012 contains four different versions
of Windows Server 2012.
You can download from the Microsoft website at
http://technet.microsoft.com/en-us/evalcenter/hh670538.aspx.
WINDOWS IMAGING (WIM) FILE FORMAT
To learn more about the Windows Imaging (WIM) file format, consult the following Microsoft
white paper: http://www.microsoft.com/en-us/download/details.aspx?id=13096.
Configuring Windows images
Although you can deploy Windows Server 2012 straight off the installation media, in enterprise environments you will want to make modifications to the image. The Deployment Image Servicing and Management (DISM) tool is a command-line tool that you can use to manage images in an offline state. The advantage of performing offline modifications to images is that you don’t need to install an operating system and then perform a capture to make changes.
You can use Dism.exe to perform the following tasks:
- Enable or disable roles and features
- Add, remove, and list software updates
- Add, remove, and list software drivers
- Add, remove, and list software packages in .appx format to a Windows image
For example, you can take the Install.wim file from the Windows Server 2012 installation media and use Dism.exe to mount that image, add new drivers and recent software updates to that image, and save those changes—all without having to perform a Windows Server 2012 deployment. The advantage is that when you do use this updated image for deployment, the drivers and updates that you added are already applied to the image. You don’t have to install them as part of your post-installation configuration routine.
Servicing Windows images
As a systems administrator responsible for deploying Windows Server 2012, you need to ensure that your deployment images are kept up to date. The latest software updates must be applied to the image, and any new device drivers for commonly used server hardware should be included.
The main goals of an image servicing strategy are the following:
- Ensure that the latest software updates and hotfixes are applied to the image before the image is deployed to new servers.
- Ensure that the latest drivers are applied to the image before the image is deployed to new servers.
If you don’t take these steps, you’ll have to wait until after you’ve deployed the operating system before you can apply updates and drivers, which consumes a significant amount of time. If your images are up to date, you won’t have to pause between deploying Windows Server 2012 and waiting for it to contact Microsoft Update or the local Windows Server Update Services (WSUS) server before you can move on to the next step (for example, deploying a server application such as Microsoft Exchange 2013, Microsoft SharePoint 2013, or Microsoft SQL Server 2012).
Using Dism.exe to service images
The Dism.exe command-line utility is included with the Windows Server 2012 operating system. You can use the Dism.exe utility to service the current operating system in an online state or perform offline servicing of a Windows image. This lesson is concerned with performing maintenance of installation images, so it covers only that aspect of Dism.exe functionality.
Servicing images with Dism.exe involves performing the following general steps:
- Mount the image so that it can be modified.
- Service the image.
- Commit or discard the changes made to the image.
Mounting images
By mounting an image, you can make changes to that image. When you mount an image, you link it to a folder. You can use File Explorer, Windows PowerShell, or Cmd.exe to navigate the structure of this folder and interact with it as you would any other folder located on the file system. Once the image is mounted, you can also use Dism.exe to perform servicing tasks, such as adding and removing drivers and updates.
A single WIM image can contain multiple operating system images. Each operating system image is assigned an index number, which you need to know before you can use Dism.exe to mount the image with the /Get-wiminfo switch. For example, if you have an image named Install.wim located in the C:\Images folder, you can use the following command to get a list of the operating system images it contains:
Dism.exe /get-wiminfo /wimfile:c:\images\install.wim
Shows the result of this command and lists the images contained in Windows Server 2012. The Standard Edition of Windows Server 2012 is assigned index identity 2, the Server Core version of the Standard Edition is listed as index identity 1, the Server Core version of the Datacenter Edition is assigned index identity 3, and the version of the Datacenter Edition that installs the GUI components is assigned index identity 4.
List of images in a .wim file
Once you have determined which operating system image you want to service, use the /Mount-image switch with the Dism.exe command to mount that image. For example, to mount the Standard Edition of Windows Server 2012 from the Install.wim file that is available with the Evaluation Edition in the C:\Mount folder, issue this command:
Dism.exe /mount-image /imagefile:c:\images\install.wim /index:2 /mountdir:c:\mount
Adding drivers and updates to images
Once you have mounted an image, you can start to service that image. When servicing images used to deploy Windows Server 2012, the most common tasks are adding device drivers and software updates to the image. You can use the /Add-Driver switch with the Dism.exe command to add a driver to a mounted image. When using the switch by itself, you need to specify the location of the driver’s .inf file. Rather than adding a driver at a time, you can use the /recurse option to have all drivers located in a folder and its subfolders added to an image. For example, to add all the drivers located in and under the C:\Drivers folder to the image mounted in the C:\Mount folder, use this command:
Dism.exe /image:c:\mount /Add-Driver /driver:c:\drivers\ /recurse
You can use the /Get-Driver option to list all drivers that have been added to the image and the /Remove-Driver option to remove a driver from an image. You can remove only drivers that you or someone else has added to an image; you can’t remove any of the drivers that were present in the image when it was published by Microsoft. You might choose to remove an existing driver if the driver you added in the past has since been updated.
You can use Dism.exe with the /Add-Package switch to add packages that contain updates or packages in .cab or .msu format. Software updates are available from the Microsoft Update Catalog website in .msu format. For example, if you download an update from the Microsoft Update Catalog website named Update for Windows Server 2012 (KB2756872) to the C:\Updates folder on a computer and you mounted a WIM image of the Windows Server 2012 operating system in the C:\Mount folder, you could apply the update to the image by using this command:
Dism.exe /image:c:\mount /Add-Package /PackagePath:"c:\updates\ Update for Windows
Server 2012 (KB2756872)"
The updates in this folder in .msu format are then applied to the mounted image. You can use the /Get-Package option to list the updates and packages that were already added to the image.
Adding updates to the image
Adding features and app packages
You can determine which features are available in a mounted operating system image by using the /Get-Features switch. For example, to learn which features are available in the image mounted in the C:\Mount folder, use this command:
Dism.exe /image:c:\mount /Get-Features
You can enable or disable a specific feature using the /Enable-Feature switch. For example, to enable the NetFx3ServerFeatures feature, which enables the .NET Framework 3.5 server features in an image, use this command:
Dism.exe /image:c:\mount /Enable-Feature /all /FeatureName:NetFx3ServerFeatures
Some features in the Windows Server 2012 image are in a state in which they are listed as having their payload removed, which means that the installation files for that feature are not included in the image. If you install a feature that had its payload removed when the operating system was deployed, the operating system can download the files from the Microsoft Update servers on the Internet. You can also specify the location of the installation files. The installation files for the features that have had their payload removed in Windows Server 2012 are located in the \Sources\sxs folder of the volume in which the installation media is located.
You can add these payload-removed features to an image by using Dism.exe and specifying the source directory. For example, to modify an image mounted in the C:\Mount folder so that the Microsoft .NET Framework 3.5 features are installed and available, issue this command when the installation media is located on volume D:
Dism.exe /image:c:\mount /Enable-Feature /all /FeatureName:NetFx3 /Source:d:\sources\sxs
You can add, remove, and list provisioned app packages to an install image. App packages are in .appx files and are used with computers running the Windows 8 and Windows Server 2012 operating system. When you add a provisioned app package to an install image, the application will be installed for all users. You use the /Add-ProvisionedAppxPackage, /Get-ProvisionedAppxPackage, and /Remove-ProvisionedAppxPackage switches with the Dism.exe command to accomplish these goals.
Committing an image
When you finish servicing an image, you can save your changes using the /Unmount-Wim switch with the /Commit option. You can discard changes using the /discard option. For example, to make changes and then commit the image mounted in the C:\Mount folder, use this command:
Dism.exe /Unmount-Wim /MountDir:c:\mount /commit
Once you have committed the changes, the .wim file that you originally mounted is updated with these modifications. You can then import this .wim file into WDS or System Center 2012 Configuration Manager for deployment, or use it with bootable USB installation media to deploy Windows Server 2012 with these updates already applied.
Build and capture
The build and capture process is commonly used with client operating systems and less commonly with server operating systems. When you perform a build and capture, you deploy an operating system; provision that operating system with updates, applications, and drivers; and then capture that operating system for deployment. Build and capture is used less often with server operating systems because they rarely require the same sort of application deployment that is required for client operating systems. Although it is possible to perform build and capture with applications such as SQL Server 2012, many organizations are starting to use Microsoft Server Application Virtualization to simplify the process of deploying applications to servers.
If your deployment strategy does involve the deployment and capture of Windows Server 2012, you need to remember that you’ll need to generalize the image prior to capture, removing any configuration information that is specific to the installation. You can perform this task using the Sysprep.exe utility. Sysprep.exe is included with Windows Server 2012 and has the dialog box shown in Figure 1-4. When you use Sysprep.exe to prepare the image, you can configure the image to return to the System Out-of-Box Experience (OOBE). This is the same experience you get when Windows Server 2012 boots for the first time, though in this case all the updates, applications, and drivers included in the captured image will be included in the newly deployed image.
Sysprep dialog box
With previous versions of the Windows Server operating system, you would use a utility known as ImageX.exe to capture and apply images. To perform these tasks, you would boot a prepared server into a special Windows Preinstallation Environment (Windows PE) environment that included these tools. You would then use the ImageX.exe tool to capture the prepared operating system in .wim format, saving it on a separate volume or on a network share. This image capture and deployment functionality is now present in the Dism.exe commandline utility. You can use Dism.exe with the /Capture-Image switch to capture an image and the /Apply-Image switch to write an existing image to a volume.
Summary:
Install.wim, located in the \Sources folder of the Windows Server 2012 installation media, stores the Windows Server 2012 operating system images.
- You can use Dism.exe to add and remove drivers and software updates from installation images.
- You must mount an installation image before you can modify it.
- You must commit your changes when dismounting an installation image to have those changes saved.
- Use Sysprep.exe to prepare an image for capture.




No comments:
Post a Comment