Where Customization Begins 

  • Examples of DISM commands. Build your custom 7 with DISM

  • Windows® Automated Installation Kit (WAIK), Windows System Image Manager (WSIM), Win PE and Windows Assessment and Deployment Kit (ADK) Tutorials are right here.
Windows® Automated Installation Kit (WAIK), Windows System Image Manager (WSIM), Win PE and Windows Assessment and Deployment Kit (ADK) Tutorials are right here.
 #2344  by Neuropass
 31 Jan 2010, 04:46
DISM (Deployment Image Servicing and Management) is a new command line tool of the Windows 7 WAIK (Windows Automated Installation Kit).

Get The latest Waik here:
Microsoft Download centre

To use it under 7 just start up the CMD utility and type in the commands below.



The commands below have been all tested.
DISM parameters are not case sensitive, so you can spare a few keystrokes if you want.
Source and other commands:DISM Commands





Help commands:
Code: Select allDism /?
Dism /image: c:\TEST_FOLDER /Add-Driver /?
Dism /image:c:\TEST_FOLDER /Add-Package /?
Dism /online /Get-Drivers /?


Emergency command:
If your mounted image gets stuck run the command below to force any mounted images:
Code: Select alldism /Cleanup-Wim




NOTE:
c:\Users\Admin\Desktop\install.wim is the location of where your image.wim resides , so you should change the path in order to be able to work on your own image

Get info about the .wim image content :
Code: Select alldism /Get-WimInfo /WimFile:c:\Users\davide\Desktop\install.wim





NOTE:
you will get information about a specific image such as the OS version, size, installed service pack, etc.

information about a specific image:
Code: Select alldism /Get-WimInfo /WimFile:c:\Users\davide\Desktop\install.wim /index:4





NOTE:
Before you can work with a WIM image, you have to mount it to a folder. DISM’s syntax differs from that of imageX. Perhaps DISM’s is easier to read in scripts, but it also requires more typing work, than imageX’s. careful to change the path correctly.

Mount the image:
Code: Select alldism /Mount-Wim /wimfile:c:\Users\davide\Desktop\install.wim /index:4 /MountDir:c:\TEST_FOLDER





Save the image only:
Code: Select alldism /Commit-Wim /MountDir:c:\TEST_FOLDER





Save and unmount the image:
Code: Select alldism /Unmount-Wim /MountDir:c:\TEST_FOLDER /commit






Unmount the image without saving it:
Code: Select alldism /Unmount-Wim /MountDir:c:\TEST_FOLDER /discard





NOTE:
Lists the images that are currently mounted and information about the mounted image such as read/write permissions, mount location, mounted file path, and mounted image index.

Mounted images check:
Code: Select allDism /Get-MountedWimInfo





Get 3rd party drivers list info installed on the OS :
Code: Select alldism /image:c:\TEST_FOLDER /Get-Drivers






NOTE:
When you use the /Driver option to point to a folder, INF files that are not valid driver packages are ignored. These files are reported on the console when the command runs, and a warning is included in the log file. You will not receive an error message.

Add Drivers:(single one)
Code: Select allDism /image:c:\TEST_FOLDER /Add-Driver /driver:c:\TEST_DRIVERS_FOLDER\mydriver.INF

Or to point to a folder with several drivers:(in the same folder)
Code: Select allDism /image:c:\TEST_FOLDER /Add-Driver /driver:c:\TEST_DRIVERS_FOLDER\

Or to point to a folder with other subfolders in it:
Code: Select allDism /image:c:\TEST_FOLDER /Add-Driver /driver:c:\TEST_DRIVERS_FOLDER /recurse

Or to install drivers unsigned:(for x64 systems purpose)
Code: Select allDism /image:c:\TEST_FOLDER /Add-Driver /driver:c:\TEST_DRIVERS_FOLDER\mydriver.INF /ForceUnsigned



Remove a specific driver
Code: Select allDism /Image:E:\Mount /Get-Drivers

Code: Select allDISM /Remove-Driver /Image:E:\Mount /Driver:oem9.inf



Get the the drivers list on a txt file
Code: Select allDism /image:c:\TEST_FOLDER /Get-Drivers > c:\x64\driverlist.txt



Get list info about international settings and languages:
Code: Select alldism /image:c:\TEST_FOLDER /Get-Intl






get (Windows features) list info:
Code: Select alldism /image:c:\TEST_FOLDER /Get-Features






NOTE:
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.

enumerate all Windows features with this command:
Code: Select alldism /image:c:\TEST_FOLDER /Get-Features | more






NOTE:
This command will enable windows features but in order to have it working you have to specify the features that you want to enable,so type the name exactly how it is shown with the previous command above.

Enable windows features:
Code: Select alldism.exe /image:c:\TEST_FOLDER /Enable-Feature:

Example:
Code: Select alldsim.exe /image:c:\TEST_FOLDER /Enable-Feature:Solitaire





NOTE:
Same thing here as the above note. you have to specify the features.

Disable windows features:
Code: Select alldism.exe /image:c:\TEST_FOLDER /Disable-Feature:

Example:
Code: Select alldsim.exe /image:c:\TEST_FOLDER /Disable-Feature:SpiderSolitaire





All the win 7 packages are hidden, to stop you from being able to remove them. you need to use a special tool to unhide them. Unhide tool download. Download and double click on the exe contained in the file (your .wim image must be previously mounted with dism) and the n type in the location of the mounted .wim image. Hit enter and it will unhide the packages. after that you can use the command below to get all your packages names and eventually remove what you wish.


get (feature packs, language packs, updates, etc.) list info:
Code: Select alldism /image:c:\TEST_FOLDER /Get-Packages






NOTE:
when you have several updates just point the path to the directory with all your files

Add a package (specific package name, like update1.msu or .cab)
Code: Select alldism /image:c:\TEST_FOLDER /Add-Package /PackagePath:c:\UPDATES_FOLDER\package_Example.msu

Add a package or updates contained in a specific folder:
Code: Select alldism /image:c:\TEST_FOLDER /Add-Package /PackagePath:c:\UPDATES_FOLDER





NOTE:
This command will remove packages but in order to have it working you have to specify the packages that you want to remove,so type the name exactly how it is shown with the previous command above.

Remove packages:
Code: Select alldism /image:c:\TEST_FOLDER /Remove-Package /PackageName:

Example:
Code: Select alldism /image:c:\TEST_FOLDER /Remove-Package /PackageName:Microsoft-Windows-LocalPack-AU-Package~31bf3856ad364e35~x86~~6.1.7600.16385






Performs cleanup and recovery operations on the image.
Code: Select all/Cleanup-Image






Insert the product key into the offline image.
Code: Select all/Set-ProductKey






Displays a list of Windows editions that can be removed from the specified image.

Code: Select all/Get-StagedEditions






Displays a list of Windows editions that animage can be upgraded to.
Code: Select all/Get-TargetEditions







Removes a staged edition from the image.

Code: Select all/Remove-StagedEdition





Apply an unattended file to an image:
Code: Select alldism /image:c:\TEST_FOLDER /Apply-Unattend:c:\answerfiles_FOLDER\myunattend.xml