Doing things differently with Windows 7

Because I wanted to keep a lot of these blog posts relevant to servicing the operating system, I thought I would talk a little about the changes to how we service the operating system in Windows 7. 

The first concept I wanted to cover was the idea of "online" vs "offline" servicing.  In online servicing, you are making changes to a live system using any variety of tools.  The easiest way to online service an installation is to simply install a Windows Update.  You can manually do this with PKGMGR or other tools as well, but the idea is that the system is live.  With offline servicing, you're mounting an image (a .WIM file in this case) to a folder and then performing operations against it using tools such as PEIMG or PKGMGR to inject drivers, fixes, etc into the image so that it can be deployed at a later time.

In Windows Vista and 2008, we had a lot of tools that we used to service the operating system and they could be confusing as to which tool did what.  Most people ended up using PKGMGR for the majority of their servicing operations online or offline, and while this isnt a bad thing, it can cause issues.  Because PKGMGR doesnt do any real checking against dependancies for things such as required reboots, customers would sometimes find themselves in the position of having random component store corruption, or post deployment corruption because of a few manually installed updates that both had reboot requirements.

Because there were so many tools and ways to do things, we decided it might be a good idea to have a "one stop tool" that does both the online and offline servicing of images and installations in Windows 7.  Enter DISM.exe.  DISM (Deployment Image Servicing and Management Tool) will act as the replacement for several tools that existed with Windows Vista and 2008.  The largest of which is PKGMGR.  Anything you could do with PKGMGR you can do with DISM.  The structure is a little different but the core concepts are the same.  The main difference is that DISM has built in logging, which is logged to \Windows\Logs\DISM\DISM.log and that you can specify what kind of servicing you wish to do (online or offline).

The general help for DISM looks like this (as of RC1 and subject to change by RTM):

Deployment Image Servicing and Management tool
Version: 6.1.7100.0

DISM.exe [dism_options] {WIM_command} [<WIM_arguments>]
DISM.exe {/Image:<path_to_offline_image> | /Online} [dism_options]
         {servicing_command} [<servicing_arguments>]

DESCRIPTION:

  DISM enumerates, installs, uninstalls, configures, and updates features
  and packages in Windows images. The commands that are available depend
  on the image being serviced and whether the image is offline or running.

WIM COMMANDS:

  /Get-MountedWimInfo     - Displays information about mounted WIM images.
  /Get-WimInfo            - Displays information about images in a WIM file.
  /Commit-Wim             - Saves changes to a mounted WIM image.
  /Unmount-Wim            - Unmounts a mounted WIM image.
  /Mount-Wim              - Mounts an image from a WIM file.
  /Remount-Wim            - Recovers an orphaned WIM mount directory.
  /Cleanup-Wim            - Deletes resources associated with mounted WIM
                            images that are corrupt.

IMAGE SPECIFICATIONS:

  /Online                 - Targets the running operating system.
  /Image                  - Specifies the path to the root directory of an
                            offline Windows image.

DISM OPTIONS:

  /English                - Displays command line output in English.
  /Format                 - Specifies the report output format.
  /WinDir                 - Specifies the path to the Windows directory.
  /SysDriveDir            - Specifies the path to the system-loader file named
                            BootMgr.
  /LogPath                - Specifies the logfile path.
  /LogLevel               - Specifies the output level shown in the log (1-4).
  /NoRestart              - Suppresses automatic reboots and reboot prompts.
  /Quiet                  - Suppresses all output except for error messages.
  /ScratchDir             - Specifies the path to a scratch directory.

What is interesting about the DISM help is that it doesnt give you all of the options.  You have to specify the /online switch to see the other options.

The following commands may be used to service the image:

WINDOWS EDITION SERVICING COMMANDS:

  /Set-ProductKey         - Populates the product key into the offline image.
  /Get-TargetEditions     - Displays a list of Windows editions that an
                            image can be upgraded to.
  /Get-CurrentEdition     - Displays the editions of the specified image.
  /Set-Edition            - Upgrades the Windows image to a higher edition.

UNATTEND SERVICING COMMANDS:

  /Apply-Unattend         - Applies an unattend file to an image.

DRIVER SERVICING COMMANDS:

  /Remove-Driver          - Removes driver packages from an offline image.
  /Add-Driver             - Adds driver packages to an offline image.
  /Get-DriverInfo         - Displays information about a specific driver
                            in an offline image or a running operating system.
  /Get-Drivers            - Displays information about all drivers in
                            an offline image or a running operating system.

INTERNATIONAL SERVICING COMMANDS:

  /Set-LayeredDriver      - Sets keyboard layered driver.
  /Set-UILang             - Sets the default system UI language that is used
                            in the mounted offline image.
  /Set-UILangFallback     - Sets the fallback default language for the system
                            UI in the mounted offline image.
  /Set-UserLocale         - Sets the user locale in the mounted offline image.
  /Set-SysLocale          - Sets the language for non-Unicode programs (also
                            called system locale) and font settings in the
                            mounted offline image.
  /Set-InputLocale        - Sets the input locales and keyboard layouts to
                            use in the mounted offline image.
  /Set-TimeZone           - Sets the default time zone in the mounted offline
                            image.
  /Set-AllIntl            - Sets all international settings in the mounted
                            offline image.
  /Set-SKUIntlDefaults    - Sets all international settings to the default
                            values for the specified SKU language in the
                            mounted offline image.
  /Gen-LangIni            - Generates a new lang.ini file.
  /Set-SetupUILang        - Defines the default language that will be used
                            by setup.
  /Get-Intl               - Displays information about the international
                            settings and languages.

APPLICATION SERVICING COMMANDS:

  /Check-AppPatch         - Displays information if the MSP patches are
                            applicable to the mounted image.
  /Get-AppPatchInfo       - Displays information about installed MSP patches.
  /Get-AppPatches         - Displays information about all applied MSP patches
                            for all installed applications.
  /Get-AppInfo            - Displays information about a specific installed MSI
                            application.
  /Get-Apps               - Displays information about all installed MSI
                            applications.

PACKAGE SERVICING COMMANDS:

  /Add-Package            - Adds packages to the image.
  /Remove-Package         - Removes packages from the image.
  /Enable-Feature         - Enables a specific feature in the image.
  /Disable-Feature        - Disables a specific feature in the image.
  /Get-Packages           - Displays information about all packages in
                            the image.
  /Get-PackageInfo        - Displays information about a specific package.
  /Get-Features           - Displays information about all features in
                            a package.
  /Get-FeatureInfo        - Displays information about a specific feature.
  /Cleanup-Image          - Performs cleanup and recovery operations on the
                            image.

So as you can see, there are a ton of options available with this tool.  I will discuss some of the specific uses and PKGMGR parity in a later blog.  I just wanted people to start thinking about this now.

As a side note, PKGMGR and the other tools DISM replaces are still in box but they are being deprecated, so it would be a good idea to update any current scripts that utilize the older tools to include the new DISM commands.