Managing Windows 7 with DISM

Managing Windows 7 with DISM

  • Comments 4
  • Likes

This week I am proud to feature guest blogger Justin Rodino. He is a Microsoft Desktop Experience MVP and a member of our STEP (Springboard Technical Experts Panel) program. His own blog is available here. This weeks guest blogger topic is on the new DISM tool. A great way to make deploying and maintaining Windows 7 images easier.

What is DISM

DISM – the Deployment Imaging Servicing and Management Tool is a new part of Windows 7 that has been created to help you manage (and deploy) images with greater ease. Previous versions of Windows included tools such as:

  • ImageX – a tool which allowed you to mount offline images
  • Pkgmgr – A device driver and package manager
  • PEImg – A WindowsPE Utility to prepare images once edited with pkgmgr
  • Intlcfg – An International Settings Configuration Tool

All of the above tools have very specific feature sets, but using these makes modifying and changing the created images very cumbersome. The first problem naturally was which tool to use when.  Once you figured this out, you had to go through a series of steps in order to get the image mounted – of which you could only do “offline” – and when completed you had to recompile or re-make the new image you wished to deploy.  With DISM, all of these tools become one and even better – you can do certain things to an “online” or live image.  What we’re going to do is take a quick look at DISM, get some information about our current installation as well as service it, whilst using it.

Starting DISM

The first thing we need to do in order to run DISM is have an elevated command prompt open.  Simply going Start –> Run –> cmd –> Enter won’t do the trick as that runs with user privileges.  What we need to do is either do Start –> Run –> Cmd –> Shift+CTRL+Enter or Click on Start type cmd and when it appear in the search box, right click on it and choose “Run as Administrator”:

1 (2)

Once we’ve got the elevated command prompt open – we can check this by looking in the task bar and the title should be prefixed by “Administrator:

2 (2)

Now if we type “dism” we should get help about dism.  If you get the message:

Error: 740

Elevated permissions are required to run DISM.
Use an elevated command prompt to complete these tasks.

Then you didn’t successfully get a command prompt with elevated privileges open.

Finding Basic Information With DISM

Now that we’ve got our command prompt ready for action, we can find some basic information about the OS we’re currently running. At the prompt type:

dism /online /Get-CurrentEdition

This tells dism we want to use the current version (/online) and the command – similar to PowerShell – tells dism we want to get information about the current edition (/Get-CurrentEdition).  Proving successful the results should return something like:

Deployment Image Servicing and Management tool
Version: 6.1.7100.0

Image Version: 6.1.7100.0

Current edition is:

Current Edition : Ultimate

The operation completed successfully.

Now let’s take it one step further.  As there are different versions of Windows 7 available, we have the potential to upgrade.  If we run dism (referencing the online image - /online) with /Get-TargetEditions, it will tell us what versions we can upgrade to (if at all possible).  So, if I run

dism /online /Get-TargetEditions

against a machine that is already running Windows 7 Ultimate, DISM should return:

Deployment Image Servicing and Management tool
Version: 6.1.7100.0

Image Version: 6.1.7100.0

Editions that can be upgraded to:

(The current edition cannot be upgraded to any target editions.)

The operation completed successfully.

So, scripting the above can prove useful if we need to interrogate or find information about our existing machine or its capabilities.

Changing the System with DISM

As well as querying the system for information, one of the most powerful features of DISM is its capability to “service” an “online” or live image.  This allows us the capability to change the OS on the fly.  For example, Windows 7 ships with numerous games and features installed that we might not want as part of our corporate build.  Using the functionality built in to DISM – whilst the OS is running – we can remove these features.

First, let’s look at what is installed and what we can change.  To do this, at the prompt we need to type:

dism /online /Get-Features | more

Again, we reference the current version (/online) and we use the command /Get-Features to show us the currently installed features.  The “| more” simply paginates the output so we can see it without having to scroll.  If we look through the list some of the features we want to remove can be seen:

….

Feature Name : FreeCell
State : Enabled

Feature Name : Minesweeper
State : Enabled

Feature Name : PurblePlace
State : Enabled

….

As the state of these currently shows “Enabled” we want to remove or disable them.  Using DISM, we can easily do this.  At the prompt we can type:

dism /online /Disable-Feature /FeatureName:<NAME GOES HERE>

Where we simply replace <NAME GOES HERE> with the feature from the list of results we got using /Get-Features.  NOTE: The features are CaSe SEnSItivE.  As an example, if we wanted to remove PurblePlace, we could simply enter:

dism /online /Disable-Feature /FeatureName:PurblePlace

at which time DISM will kick in and should return results like the following:

Deployment Image Servicing and Management tool
Version: 6.1.7100.0

Image Version: 6.1.7100.0

Disabling feature(s)
[==========================100.0%==========================]
The operation completed successfully.

Let’s now check to see if it was disabled:

dism /online /Get-FeatureInfo /FeatureName:PurblePlace

Deployment Image Servicing and Management tool
Version: 6.1.7100.0

Image Version: 6.1.7100.0

Feature Information:

Feature Name : PurblePlace
Display Name : Purble Place
Description : Purble Place
Restart Required : Possible
State : Disabled

Custom Properties:

(No custom properties found)

The operation completed successfully.

As we can see “State : Disabled” means we’ve disabled it.  Should we want to re-enable it, we can simply type:

dism /online /Enable-Feature /FeatureName:PurblePlace

At which time DISM will put the feature back on the machine in a similar way it removed it:

Deployment Image Servicing and Management tool
Version: 6.1.7100.0

Image Version: 6.1.7100.0

Enabling feature(s)
[==========================100.0%==========================]
The operation completed successfully.

Conclusion

As you can see DISM is a very powerful tool and the introduction of online/live servicing makes it even more useful to the IT professional.  To get more information about DISM or any of its functions or capabilities, use the /? flag when you get stuck.  Some examples include:

  • “dism /?” – which will tell you about the root level capabilities
  • “dism /online /?” – which will tell you about the online image servicing capabilities
  • “dism /online /Get-Features /?” – which will tell you about the Get-Features function

And from there, the sky’s the limit.  Happy DISM’ing.

4 Comments
You must be logged in to comment. Sign in or Join Now
  • anonymuos
    87 Posts

    Something like this: www.msfn.org/.../mr-jinje-dism-tool-t138804.html

  • all the DISM features! keep the command line for scripting but give a full GUI - GImageX is a nice example of how to do a  tool like this; it doesn't need to be a wizard but something that logically groups the options and gives you a flow through the process.

  • Hi Anonymous,

    What kind of GUI would you want to see or what would you like to see available in the GUI?

  • anonymuos
    87 Posts

    Want GUI for DISM please.