To add packages to an offline image by using DISM
-
At an elevated command prompt, locate the
Windows ADK servicing folder, and type the following command to
retrieve the name or index number for the image that you want to modify.
An index or name value is required for most operations that specify an image file.Dism /Get-ImageInfo /ImageFile:C:\test\images\install.wim
-
Type the following command to mount the offline Windows image.
Dism /Mount-Image /ImageFile:C:\test\images\install.wim /Name:
"Windows 7 HomeBasic" /MountDir:C:\test\offline
-
At a command prompt, type the following command to add a
specific package to the image. You can add multiple packages on one
command line. They will be installed in the order listed in the command
line.
Dism /Image:C:\test\offline /Add-Package /PackagePath:C:\packages
\package1.cab /PackagePath:C:\packages\package2.cab
-
At a command prompt, type the following command to commit the changes and unmount the image.
Dism /Unmount-Image /MountDir:C:\test\offline /Commit
To remove packages from an offline image by using DISM
-
At an elevated command prompt, locate the
Windows ADK servicing folder, and type the following command to
retrieve the name or index number for the image that you want to modify.
An index or name value is required for most operations that specify an image file.Dism /Get-ImageInfo /ImageFile:C:\test\images\install.wim
-
Type the following command to mount the offline Windows image.
Dism /Mount-Image /ImageFile:C:\test\images\install.wim /Name:
"Windows 7 HomeBasic" /MountDir:C:\test\offline
-
Optional: Type the following command to list the packages in the image.
You can useDism /Image:C:\test\offline /Get-Packages
>featurelist.txtto redirect the output of the command to a text file that is named FeatureList.
-
Review the list of packages that are available in your mounted image and note the package identity of the package.
-
At a command prompt, specify the package identity to
remove it from the image. You can remove multiple packages on one
command line.
You can use the /PackagePath option to point to the original source of the package, or to specify the path to the .cab file, or you can use the /PackageName option to specify the package by name as it is listed in the image. For more information, see DISM Operating System Package Servicing Command-Line Options.DISM /Image:C:\test\offline /Remove-Package /PackageName:Microsoft
.Windows.Calc.Demo~6595b6144ccf1df~x86~en~1.0.0.0 /PackageName:
Microsoft-Windows-MediaPlayer-Package~31bf3856ad364e35
~x86~~6.1.6801.0
-
At a command prompt, type the following command to commit the changes and unmount the image.
Dism /Unmount-Image /MountDir:C:\test\offline
To add or remove packages offline by using DISM and an answer file
-
Open Windows SIM.
-
To add a new package, click Insert on the main menu, and select Package(s). Browse to the package you want to add, and then click Open.
-
To remove an existing package, select the package in the Answer file pane that you want to remove. In the Properties pane, change the Action property to Remove.
Note The packages must be added to the offlineServicing configuration pass. -
Validate and save the answer file.
-
At an elevated command prompt, locate the
Windows ADK servicing folder, and then type the following command
to retrieve the name or index number for the image that you want to
mount.
Dism /Get-ImageInfo /ImageFile:C:\test\images\install.wim
-
Type the following command to mount the offline Windows image.
An index or name value is required for most operations that specify an image file.Dism /Mount-Image /ImageFile:C:\test\images\install.wim /name:
"Windows "Windows 7 HomeBasic" /MountDir:C:\test\offline
-
At a command prompt, type the following command to apply the unattended answer file to the image.
DISM /Image:C:\test\offline /Apply-Unattend:C:\test\answerfiles\
myunattend.xml
-
At a command prompt, type the following command to commit the changes and unmount the image.
Dism /Unmount-Image /MountDir:C:\test\offline /Commit
Emoticon Emoticon