Export (0) Print
Expand All

Best Practices for Servicing

Published: October 22, 2009

Updated: October 22, 2009

Applies To: Windows 7, Windows Server 2008 R2

noteNote
This content applies to Windows 7. For Windows 8 content, see Windows Deployment with the Windows ADK.

This section describes some best practices related to servicing a Windows® image. We recommend that you implement these practices wherever possible.

Elevate Permissions for Command-Line tools

All deployment command-line tools, including Deployment Image Servicing and Management (DISM), require elevated permissions.

To make sure you have elevated permissions click Start, point to All Programs, point to Windows OPK (or Windows AIK), right-click Deployment Tools Command Prompt, and then select Run as administrator.

This must be done even if you are logged on as an administrator.

Servicing an Image

The best way to service a Windows image is offline with the DISM tool. DISM can be used to install, uninstall, configure, and update drivers, features, and packages in Windows images and Windows Preinstallation Environment (Windows PE) images without booting the image. For more information, see Deployment Image Servicing and Management Technical Reference.

noteNote
If you have split the .wim file into smaller files for spanning across multiple media, you cannot mount the image for servicing.

Servicing and Running Windows Setup from Windows PE 2003 or Windows Server 2003

Before servicing a Windows® 7 image, or running Windows 7 Setup from Windows PE 2003 or Windows Server 2003, you must first copy the MSXML6 binaries into your \%WINDIR%\System32 directory. MSXML6 is available on the Windows Automated Installation Kit (Windows AIK) and the OEM Preinstallation Kit (OPK) media. It is also available for download from the Microsoft Download Center.

Hotfix Required for 64-Bit Host Environments

Before using DISM with the /Add-Package, /Enable-Feature or /Disable-Feature options from a 64-bit Windows Vista® with Service Pack 1 (SP1) host, Windows Server® 2008, or Windows Server 2003 R2 host, you must install a hotfix.

The hotfix is available on the Windows OPK and Windows AIK media, in the following locations:

  • For 64-bit Windows Vista with SP1 or Windows Server 2008 host operating system, install the hotfix from \HotFix\KB960037\VistaSp1_WS08

  • For a 64-bit Windows Server 2003 R2 hosts operating system, install the hotfix from \HotFix\KB960037\W2K3

Double-click the appropriate .exe file to install the hotfix.

If you do not install the hotfix, you will receive the following warning message after you run the command:

To service a Windows 7 image from this host environment, you must install hotfix KB960037 on the host computer. The hotfix is available on the Windows OPK and Windows AIK media, in the hotfix <%mediaroot%>\HotFix folder.

DISM Cross-Architecture Support

Always use the version of DISM that matches the architecture of the servicing host when servicing target image of any architecture. You can find the native architecture version of DISM at the following locations on the servicing host:

  • Installed by default on Windows 7: <%WINDIR%>\System32

  • Installed from the Windows OPK or Windows AIK: %ProgramFiles%\Tools\Servicing

When running DISM on a Windows PE servicing host:

  • The x86 version of DISM supports servicing of full operating system or Windows PE target images of any architecture.

  • The x64 and IA64 versions of DISM supports servicing only of full operating system or Windows PE target images of matching architecture.

noteNote
Due to the limitation of WOW64 environment for Windows Vista with SP1 and Windows Server 2008, DISM can service a Windows Vista with SP1 or Windows Server 2008 target image of matching architecture only when running on an X64/IA64 Windows 7 servicing host.

Changing International Settings

To change the international settings in Windows 7 and Windows Server 2008 R2, you must use DISM.

The Intlcfg.exe tool is deprecated in this release, but it is still available for configuring international settings in Windows Vista and Windows Server 2008. For command-line syntax, see Intlcfg Command-Line Options. For information about using Intlcfg.exe, see the Windows Vista SP1 release of the Windows OPK or Windows AIK.

Use Log Files

DISM will log verbose information to %WINDIR%\Logs\Dism\Dism.log by default. You can also specify a name and location of your choice for the log file, and set the /loglevel parameters so that only the information you are interested in is logged. When an error occurs, the console will display the error code, error message, and the location of the log file.

ImportantImportant
If you specify a log path on a network share from a computer that is not joined to a domain, use net-use with domain credentials to set access permissions before you set the log path for the DISM log.

The log file will automatically be archived. The archived log file will be saved with .bak appended to the file name, and a new log file will be generated. Each time the log file is archived, the .bak file will be overwritten.

The log file gives you the history of the operations that have been performed, which can help you troubleshoot problems.

Stage .msi Files for OCSetup

If you are adding an out-of-box system Windows Installer with OCSetup, you must first stage the system Windows Installer. If you are installing a package online with OCSetup, use an unattended installation answer file. You can specify the path to the package in the servicing section of the answer file. For more information, see OCSetup Command-Line Options.

Package Locations

Do not put a package that you intend to install directly at the root of a partition on a Windows 7 installation.

Servicing a Windows Image from Windows PE

You can service Windows images from Windows PE. However, you must consider certain factors while planning your servicing strategy. Review the following requirements for servicing an image from Windows PE.

Running DISM from a Windows PE Servicing Host

Windows PE for Windows Vista and Windows PE for Windows 7 are supported DISM servicing hosts. When running DISM from a Windows PE servicing host, you can use the x86 version of DISM to service an image of any architecture. However, the 64-bit versions of DISM can be used to service only an image of matching architecture.

Windows PE for Windows 7 already includes DISM. However, you can use the following steps to copy DISM and all of its dependencies to Windows PE for Windows Vista.

  1. From an elevated command prompt, copy DISM to the servicing host by using the following syntax:

    xcopy /s "%ProgramFiles%\Windows OPK\Tools\<target architecture>\Servicing" <destination folder>
    
    For example, use one of the following examples:

    xcopy /s "C:\Program Files\Windows OPK\Tools\x86\Servicing" D:\Tools
    
    xcopy /s "C:\Program Files\Windows OPK\Tools\amd64\Servicing" D:\Tools
    
  2. At an elevated command prompt, copy the Wimgapi filter to the same folder that DISM was copied to using the following syntax:

    xcopy "%ProgramFiles%\Windows OPK\Tools\<target architecture>\wim*.*" <destination folder>
    
    For example, use one of the following:

    xcopy /s "C:\Program Files\Windows OPK\Tools\x86\wim*.*" D:\Tools
    
    xcopy /s "C:\Program Files\Windows OPK\Tools\amd64\wim*.*" D:\Tools
    
  3. Run WimMountInstall.exe from the servicing host after it is booted.

Booting Windows PE from a Hard Drive

For better performance, you can allocate additional memory when you boot Windows PE from a hard disk drive. You can also create temporary folders to store update files to accommodate large updates.

Add Page-File Support to Your Windows PE Image

Make sure you have sufficient memory to load and run your custom Windows PE image. In addition to the image size, you should have at least 256 MB of available working memory. If you have limited memory, define a page file (Pagefile.sys) to improve memory management. For more information on implementing a page file, see Wpeutil Command-Line Options.

Create a Temporary Directory in Which to Store Update Files

A temporary directory is used for installing language packs, updates, or installing or removing Windows features in a Windows image. Some of the files are expanded to this temporary directory before the update is applied to a Windows image. There must be sufficient space in the partition to accommodate large updates. The specific size of the free space that is required depends on the size of the updates that you intend to install.

Windows PE creates a 32-MB temporary directory by default. You can allocate additional temporary storage using the DISM /Set-ScratchSpace option. Valid sizes include 32, 64, 128, 256, and 512 MB. This feature is available only offline. You cannot adjust this setting while a Windows PE session is running. As an alternative when using DISM to service an image, you can use the /ScratchDir: <path_to_directory> option to create a temporary directory on a different drive with more space for extracting files. This directory is used for temporary storage. When adding a language pack, the scratch directory must have at least 1 GB of space for temporary files. After installation is complete, the contents of this directory are no longer needed and can be deleted. For more information, see Deployment Image Servicing and Management Command-Line Options.

Booting Windows PE from a CD-ROM/DVD

Servicing a Windows image requires additional temporary storage space. For Windows PE RAM disks, you might need additional RAM. In addition to the RAM requirements of your Windows PE image, additional RAM is required to process updates. The amount of RAM that is required depends on the size of the updates that you intend to apply. Ensure that your computer has sufficient RAM.

Verify the Integrity of System Files

Before you deliver a computer to an end user, you should verify the integrity of Windows system files. You can use System File Checker (Sfc.exe) on an online or offline reference image. System File Checker is released with all versions of Windows.

System File Checker requires elevated permissions, and you must be an Administrator to run it. It scans all protected files to verify the file versions. To verify only the integrity of the Windows system files, run the sfc.exe /verifyonly option. For complete command-line syntax, at an elevated command prompt, type sfc.exe /?.

Running Sfc.exe can take a significant amount of time. The expected result is that there are no system integrity violations. However, if there are problems with Windows system files, you should investigate the issues. We do not recommend that you use the Sfc.exe scan options to automatically fix Windows system files.

See Also

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft