Managing Windows 7 with DISM

    Managing Windows 7 with DISM


    Posted: 28 Jul 2009
    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”:



    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:



    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:

    Where we simply replace 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.


    More...
    z3r010's Avatar Posted By: z3r010
    28 Jul 2009



  1. Posts : 5,807
    Windows 7 Home Premium x64 - Mac OS X 10.6.4 x64
       #1

    z3r010 said:
    This is so much better than the way we used to do it to make lite images of 7...or Vista in the past
      My Computer


  2. Posts : 3,141
    Vista Ult 64 bit Seven Ult RTM x64
       #2

    Thanks John. Having a play with that.

    Gary
      My Computer


  3. Posts : 8,870
    Windows 7 Ult, Windows 8.1 Pro,
       #3

    How long before an easier to use software version using DISM appears?

    7Lite is coming I just know it!
      My Computer


  4. Posts : 1,519
    El Capitan / Windows 10
       #4

    DISM does NOT remove the features it disables. As such it doesn't help with disk space.
      My Computer


  5. Posts : 8,870
    Windows 7 Ult, Windows 8.1 Pro,
       #5

    I thought one of the original feature's was able to prepare images. Still could use a 7lite that could remove those feature's from the .iso's.
      My Computer


  6. Posts : 5,807
    Windows 7 Home Premium x64 - Mac OS X 10.6.4 x64
       #6

    baarod said:
    DISM does NOT remove the features it disables. As such it doesn't help with disk space.
    Not true...It also removes packages which will save on disk space
      My Computer


  7. Posts : 5,807
    Windows 7 Home Premium x64 - Mac OS X 10.6.4 x64
       #7

    chev65 said:
    I thought one of the original feature's was able to prepare images. Still could use a 7lite that could remove those feature's from the .iso's.
    nuhi has mentioned in emails that he has no intent at making 7Lite right now
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 03:46.
Find Us