Logo
PREGNANCY
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
 
 
Windows 7

Automating the Deployment of Windows 7 : Imaging with the Windows Automated Installation Kit (part 2) - Understanding the Deployment Image Servicing and Management Tool

5/17/2011 11:47:43 AM

2. Understanding the Deployment Image Servicing and Management Tool

The Deployment Image Servicing and Management (DISM) tool is also included in the Windows AIK for Windows 7. The primary benefit of DISM is its ability to modify the contents of an image hosted within a .wim file. This is referred to as offline servicing.

Earlier versions of the Windows AIK required the use of several tools including the Pkgmgr.exe, Intlcfg.exe, and PEimg.exe tools. The DISM tool provides all of the functionality for these tools in a single tool.

DISM is a command-line tool and includes a rich set of switches. If you understand how the ImageX command works with the images as described in the previous section, the DISM tool is easier to grasp. Interestingly, the DISM switches follow the verb-noun format used in Windows PowerShell.

As an example, the get verb is combined with the wiminfo noun in the /get-wiminfo switch. With the verb-noun format, the switches become easy to figure out just by looking at them.

You can access the DISM application via the Deployment Tools Command Prompt by selecting Start => All Programs => Microsoft Windows AIK => Deployment Tools Command Prompt. You'll need administrative permissions when running DISM, so you'll need to right-click the Deployment Tools Command Prompt and select Run As Administrator.

When any of the DISM switches needs to work with a .wim file, it is often specified with the /wimfile switch. The /wimfile switch takes the form of /wimfile:drivePath\filename. For example, an image named image.wim in the C:\images folder would be specified as

/wimfile:c:\images\image.wim

You'll see this used in many commands mentioned in this section. As an example, the /Get-WimInfo switch is used to get information about a .wim file with this full command:

DISM /Get-WimInfo /wimfile:c:\images\image.wim

2.1. Using DISM Get Commands

Many of the get switches are used to retrieve information. Table 1 shows some of the DISM get switches you're likely to use.

Table 1. DISM get switches
SwitchDescription
/Get-HelpDisplays help for DISM.
/Get-WiminfoDisplays information on the images within a .wim file. dism /get-wiminfo /wimfile:g:\sources \install.wim
/Get-MountedWiminfoDisplays information on any images that have been mounted. This includes whether it is in read/write mode and the current status. dism /get-mountedwiminfo

2.2. Using DISM to Mount and Unmount Images

Images must be mounted before you can do any offline servicing. Although you saw earlier that you can use ImageX to mount and unmount images, you can also use DISM.

Table 2 shows some of the commands that can be used to mount, commit, and unmount images.

Table 2. DISM mount switches
SwitchDescription
/Mount-WimMounts an image to a specified directory. The format is Dism /Mount-Wim /WimFile:C:\images\install.wim /index:1 /MountDir:C:\Mount /ReadOnly/ReadOnly switch is omitted to mount the image in read/write mode. The
/Unmount-WimUnmounts the image. The /commit switch is used to write the changes to the image, and the /discard switch does not write the changes. Dism /UnMount-Wim /MountDir:C:\Mount /commit
/Commit-WimCommits the changes to the image but does not unmount the image. Dism /commit Mount-Wim /MountDir:C:\Mount /commit

2.3. Using DISM with Packages and Features

DISM can be used to install, remove, or update Windows packages to an image and manipulate installed features. Packages can be either cabinet (.cab) or Windows Update Stand-alone Installer (.msu) files and are used to distribute software updates, service packs, and language packs.

You can add many common packages to Windows PE images to extend the capabilities of the image depending on what is needed when the PE is booted. These include the following:


WinPE-HTA.cab

This installs HTML application support.


WinPE-Scripting.cab

This adds support for the Windows Scripting Host (WSH), which can be used to execute script files.


WinPE-WMI.cab

This installs support for Windows Management Instrumentation.


WinPE-WDS-Tools.cab

This installs the Windows Deployment Services tools package.

When adding packages with DISM, the package names need to match the exact case of the package. For example, WinPE-WDS-Tools.cab will not work if entered as winpe-wds-tools.cab. However, the case doesn't matter for the DISM commands. For example, DISM /GET-HELP is interpreted the same as Dism /Get-Help.


You can also add packages to regular image files (not only the PE image files). For example, drivers and applications can be added as a package to an offline image.

Table 3 shows some of the DISM switches used to add and remove different elements to an image. Each of these switches is executed against a mounted image, so the /image switch must be used within the command.

Table 3. DISM package and feature switches
SwitchDescription
/Add-PackageUse this to add a package to a mounted image. Dism /image:C:\mount /Add-Package /PackagePath:C:\packages\package.cab
/Remove-PackageUse this to remove a cabinet file package from a mounted image. Dism /image:C:\mount /Remove-Package /PackagePath:C:\packages\package.cab
/Get-PackagesThis will display information about all packages in the mounted image. Dism /image:C:\mount /Get-Packages
/Get-FeaturesThis will display a list of features that are enabled in the mounted image. Dism /Image:C:\mount /Get-Features
/Get-FeatureInfoThis will provide details on any specific feature. For example, the following command provides additional details on the installed games. The StateEnabled or Disabled. dism /image:c:\mount /Get-featureinfo /FeatureName:InboxGames property will be
/Disable-featureFeatures can be disabled using the /Disable-feature switch. The /FeatureName needs to be entered as shown in the Get-Features result. The following command will disable the default games on the image. dism /image:c:\mount /Disable-feature /FeatureName:InboxGames
/Enable-featureDisabled features can be enabled using this switch. The following command will enable the default games on the image. dism /image:c:\mount /Enable-feature /FeatureName:InboxGames


Exercise: Exploring an Image with DISM

  1. Launch the Deployment Tools Command Prompt with administrative permissions. Select Start => All Programs => Microsoft Windows AIK, right-click the Deployment Tools Command Prompt, and select Run As Administrator.

  2. If prompted by User Account Control, click Yes to continue.

  3. Determine the drive letter where your installation DVD is installed. You will substitute this drive letter for each of the commands instead of the letter x.

  4. View a listing of images in the install.wim file with the following command. Use the drive assigned to your DVD instead of the letter x.

    dism /get-wiminfo /wimfile:x:\sources\install.wim

  5. Create a directory to which you'll mount the folder with the following command:

    md c:\mount

  6. Mount the install.wim file in the c:\mount folder with the following command:

    DISM /mount-wim /wimfile:x:\sources\install.wim /index:1 /mountDir:c:\mount /ReadOnly


    If you wanted to modify the image, you would omit the /ReadOnly switch.

  7. View details on the mounted image with the following command:

    DISM /Get-MountedWimInfo

  8. View a list of the packages currently installed on the image with this command:

    DISM /image:c:\mount /Get-Packages

    Once you have mounted an image, you can refer to it using DISM with the /image:path switch. The path is the actual path where it was mounted. In the previous example, it was mounted to the c:\mount directory.

  9. Retrieve a list of features available in the mounted image with the following command:

    DISM /image:c:\mount /Get-features

  10. Disable the games feature within the image with the following command:

    DISM /image:c:\mount /Disable-feature /FeatureName:InboxGames

  11. Verify that the current state of InboxGames has been changed to disabled with the following command:

    DISM /image:c:\mount /Get-featureInfo /FeatureName:InboxGames

  12. Unmount the image using the following command:

    DISM /Unmount-Wim /mountdir:c:\mount /discard

    Because the image was mounted in read-only mode, the changes cannot be committed. However, if the image was mounted in read/write mode, the /commit switch could be added to commit the changes to the image when it is unmounted.



Other -----------------
- Automating the Deployment of Windows 7 : Choosing a Deployment Strategy
- Automating the Deployment of Windows 7 : Understanding and Designing Images
- Planning for the Installation of Windows 7 : Planning and Managing Client Licensing and Activation (part 2)
- Planning for the Installation of Windows 7 : Planning and Managing Client Licensing and Activation (part 1)
- Planning for the Installation of Windows 7 : Virtualization Considerations (part 3) - Installing Integration Components
- Planning for the Installation of Windows 7 : Virtualization Considerations (part 2) - Windows XP Mode
- Planning for the Installation of Windows 7 : Virtualization Considerations (part 1) - Considering a VDI Environment
- Planning for the Installation of Windows 7 : Designing User State Migration
- Planning for the Installation of Windows 7 : Local Installation
- Planning for the Installation of Windows 7 : Choosing a Windows 7 Edition
- Wireless Networking (part 2) - Connecting to and Managing Wireless Connections
- Wireless Networking (part 1) - Installing and Configuring a Wireless Adapter
- Configuring Dial-Up, Broadband, Wireless, and VPN (part 3)
- Configuring Dial-Up, Broadband, Wireless, and VPN (part 2)
- Configuring Dial-Up, Broadband, Wireless, and VPN (part 1) - Creating Dial-Up Connections
- Making Your Computer More Accessible (part 2)
- Making Your Computer More Accessible (part 1) - Using the Ease of Access Center & Using the Magnifier
- Using Laptop and Tablet PC Extras (part 3) - Creating a Windows Journal
- Using Laptop and Tablet PC Extras (part 2) - Using Your Tablet PC Pen
- Using Laptop and Tablet PC Extras (part 1) - Navigating the Windows Mobility Center & Connecting to Projectors
 
 
Most view of day
- Windows Server 2003 on HP ProLiant Servers : Active Directory Logical Design - Replication Topology (part 1) - Challenges and Issues in AD Replication
- Windows Phone 8 : Configuring Basic Device Settings - Backing Up Your Phone (part 3) - Backing Up Text Messages
- Windows Server 2012 : Configuring IPv6/IPv4 interoperability (part 3) - IPv6 address representation
- Windows Phone 8 : Configuring Basic Device Settings - Controlling the Keyboard’s Behavior (part 1) - Setting the Keyboard Language
- Maintaining Desktop Health : Using Task Scheduler (part 4) - Managing Tasks
- Monitoring Windows Small Business Server 2011 : Using Performance Monitor
- Protecting Windows from Viruses and Spyware : Antimalware Strategy: Defense in Depth (part 3) - Data Execution Prevention
- Maintaining Security : Authorizing Administrative Actions, Restricting Access to Web Content
- Working with the Windows Home Server Registry : Working with Registry Entries - Changing the Value of a Registry Entry
- Windows Server 2008 : Retrieving Information About Objects with dsget, Viewing and Modifying AD Permissions with dsacls
Top 10
- SQL Server 2012 : Understanding Latches and Spinlocks (part 3) - Latching Example - With Latching
- SQL Server 2012 : Understanding Latches and Spinlocks (part 2) - Latching Example - Without Latching
- SQL Server 2012 : Understanding Latches and Spinlocks (part 1) - Latching Example
- SQL Server 2012 : Latches and Spinlocks - Symptoms (part 2) - Measuring Latch Contention, Measuring Spinlock Contention , Contention Indicators
- SQL Server 2012 : Latches and Spinlocks - Symptoms (part 1) - Recognizing Symptoms
- Integrating SharePoint 2013 with the Office Applications (part 10) - Microsoft Outlook - Lists and Libraries
- Integrating SharePoint 2013 with the Office Applications (part 9) - Microsoft InfoPath - Customizing the Document Information Panel and List Forms
- Integrating SharePoint 2013 with the Office Applications (part 8) - Microsoft InfoPath -Deploying a Form Via Central Administration, Rendering a Form Using the InfoPath Form Web Part
- Integrating SharePoint 2013 with the Office Applications (part 7) - Microsoft Access - Access Services
- Integrating SharePoint 2013 with the Office Applications (part 6) - Microsoft Access
 
 
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
2015 Camaro