In my last post, I wrote about DISM's (Deployment Image Servicing and Management) Vista compatibility and its relation to imageX. Today I will post some examples that will show you how to mount a WIM image, how to gather information about an image, and how to service images with DISM.

Michael Pietroforte

Michael Pietroforte is the founder and editor in chief of 4sysops. He has more than 35 years of experience in IT management and system administration.

Before you start working with an image, you might want to have some information about the image. The following command retrieves information about the OS images that are contained within a WIM file. As you probably know, a WIM image can contain multiple OS images.

dism-get-wiminfodism /Get-WimInfo /WimFile:d:\sources\install.wim

I used Windows 7 Beta's WIM file, which you can find in the "sources" folders on the DVD. If you add the command line option /index plus the image's index number, you will get information about a specific image such as the OS version, size, installed service pack, etc. (see screenshot).

dism-get-wiminfo-index dism /Get-WimInfo /WimFile:d:\sources\install.wim /index:4

Before you can work with a WIM image, you have to mount it to a folder. DSM's syntax differs from that of imageX. Perhaps DSM's is easier to read in scripts, but it also requires more typing work, than imageX's:

dism /Mount-Wim /wimfile:c:\wim\install.wim /index:4 /MountDir:c:\img

Note that if you mount an image onto a DVD, you have to add "/ReadOnly" to the command. DISM parameters are not case sensitive, so you can spare a few keystrokes if you want. You have to replace "c:\wim\install.wim" with the location where you copied the WIM file, and "c:\img" with the folder in which you want to mount the WIM image. "/index:4" specifies the fourth OS image within the WIM image, which is Windows 7 Ultimate in install.wim.

Once you have mounted an image, you can navigate through its folder structure using Windows Explorer, and make changes to all files and folders. In most cases, however, you will be using DISM to gather specific information about an image and also to add features, drivers, and packages.

dism-get-drivers The following example lists all installed third party drivers in the image I mounted to c:\img.

dism /image:c:\img /Get-Drivers

The DISM documentation describes commands that are used to retrieve information as "management tasks." This is a bit odd because usually "management" also implies making changes to the managed object. Other examples of such management operations include Get-Features (Windows features), Get-Packages (feature packs, language packs, updates, etc.), and /Get-Intl (international settings and languages).

All commands that are related to changing an image are called "servicing tasks." The next command is such a servicing task, which disables the Solitaire game in Windows 7.

dism /image:c:\img /Disable-Feature:Solitaire

Note that you have to know the exact name if you want to enable or disable Windows features. You can enumerate all Windows features with this command:

dism /image:c:\img /Get-Features | more

Because there are more features than would fit on the screen, you have to use the pipe plus "more"; this will display the features a page at a time.

Whenever you make several changes, you should save the image's current state. This command will apply to all changes you make.

dism /Commit-Wim /MountDir:c:\img

You also can apply changes once you are finished and want to unmount the image.

dism /Unmount-Wim /MountDir:c:\img /commit

If you don't want to apply the changes, you can use the /discard parameter instead of /commit.

dism-online-get-packages DISM has an interesting feature that I mentioned in my introduction. It allows you not only to manage offline images, but also to work with the currently running operating system.

dism /online /Get-Packages

This command lists all packages installed on your Windows computer. Essentially, the /online option works like the /image parameter, but manages or services an "online image," and not an offline image.

DISM certainly is a powerful tool. In this article, I have only scratched the surface. You can find all of DISM's command line options in the WAIK (Windows Automated Installation Kit) documentation.

I have only one complaint about DISM. Some days ago, I attended a Microsoft online meeting that introduced DISM. One of the participants asked why there is no GUI version of DISM. A Microsoft developer answered that a command line tool can be used in scripts to automate tasks on multiple images. Well, this is the standard excuse for delivering command line tools. Of course, it is also possible to automate all kinds of tasks with a well-programmed GUI tool. The point is that the development of a GUI tool is more costly than a command line utility. The good news is that the developer also said that Microsoft is planning to release a GUI version of DISM in the future.

Are you an IT pro? Apply for membership!

Your question was not answered? Ask in the forum!

0
Share
31 Comments
  1. Michael Pietroforte 5 years ago

    dessi, you have to unmount the WIM file first.

    0

  2. GEal 5 years ago

    Thanks for your great information.
    The command dism /Mount-Wim... did not work for me.
    Meanwhile there is GUI for dism.exe look here http://dismgui.codeplex.com/
    The GUI also shows the executed commands this can be helpful when you want create a batch-script for later use..
    The GUI used the command: dism /Mount-Image /Imagefile:%WindowsWMIFile% /index:4 /MountDir:%MountDir% /LogPath:%LogDir%\DismMount.log to mount the image.

    best regards

    0

  3. GEal 5 years ago

    sorry i was wrong..
    the GUI also used the command "dism.exe /Mount-WIM /WimFile.."
    and again problem was on osi-layer 8 🙂
    please delete my post.. and only add the link to the dism gui
    thank you

    0

  4. C.Snyder 4 years ago

    I believe all of my devices are compromised by either a rat or spyware- I discovered a copy9 folder in android containing dialogue between ispyoo and spytic. Which I know is nothing to do with this blog.
    I found an upload with wimmanager from android and I had never even heard of wim before so i have a couple questions, please.
    Firstly, is wim only for windows or can an android use it? Are they compatible at all?
    Secondly, can it be used remotely?
    And lastly, where woukd the file be stored?
    Much appreciated. Thank you.

    0

  5. Chakri Lekkala 4 years ago

     

    0

  6. gcwiz 3 years ago

    index=3 is incorrect but index:3 is correct

    0

Leave a reply

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2020

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account