append-image · web viewthis argument is available only for windows pe images. only one volume...

25
DISM COMMANDS Deployment Image Servicing and Management The base syntax is similar for nearly all DISM commands. After you have mounted or applied your Standard 8 image so that it is available offline as a flat file structure, you can specify any DISM option, the servicing command that will update your image, and the location of the offline image. You can use only one servicing command per command line. If you are servicing a computer that is running, you can use the /Online option instead of specifying the location of the offline Standard 8 image. Benefits You can use DISM with .wim files to: Capture and apply Windows images. Append and delete images in a .wim file. Split .wim files into several smaller files. You can use DISM with .wim, .vhd, or .vhdx files to: Add, remove, and enumerate packages. Add, remove, and enumerate drivers. Enable or disable Windows features. Apply changes based on the offlineServicing section of an Unattend.xml answer file. Configure international settings. Upgrade a Windows image to a different edition. Prepare a Windows PE image. Take advantage of better logging. Service earlier versions of Windows such as Windows 7, Windows Server 2008 R2, Windows Vista with the latest Service Pack, and Windows Server 2008. 1 | Page

Upload: ngominh

Post on 30-Apr-2018

215 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Append-Image · Web viewThis argument is available only for Windows PE images. Only one volume image can be marked as bootable in a .wim file. /CheckIntegrity detects and tracks

DISM COMMANDSDeployment Image Servicing and

ManagementThe base syntax is similar for nearly all DISM commands. After

you have mounted or applied your Standard 8 image so that it is available offline as a flat file structure, you can specify any DISM option, the servicing command that will update your image, and the location of the offline image. You can use only one servicing command per command line. If you are servicing a computer that is running, you can use the /Online option instead of specifying the location of the offline Standard 8 image.

Benefits You can use DISM with .wim files to:

Capture and apply Windows images. Append and delete images in a .wim file. Split .wim files into several smaller files. You can use DISM with .wim, .vhd, or .vhdx files to: Add, remove, and enumerate packages. Add, remove, and enumerate drivers. Enable or disable Windows features. Apply changes based on the offlineServicing section of an Unattend.xml

answer file. Configure international settings. Upgrade a Windows image to a different edition. Prepare a Windows PE image. Take advantage of better logging. Service earlier versions of Windows such as Windows 7, Windows

Server 2008 R2, Windows Vista with the latest Service Pack, and Windows Server 2008.

Service all platforms (32-bit, 64-bit). Service a 32-bit image from a 64-bit host, and service a 64-bit image

from a 32-bit host. For more information, see the "Limitations" section later this topic.

Make use of old Package Manager scripts.

1 | P a g e

Page 2: Append-Image · Web viewThis argument is available only for Windows PE images. Only one volume image can be marked as bootable in a .wim file. /CheckIntegrity detects and tracks

Common Servicing and Management ScenariosImage servicing and management solutions fall into two main categories:

Managing the data or information included in the Windows image, such as enumerating or taking an inventory of the components, updates, drivers, or applications that are contained in an image, capturing or splitting an image, appending or deleting images within a .wim file, or mounting an image.

Servicing the image itself, including adding or removing driver packages and drivers, modifying language settings, enabling or disabling Windows features, and upgrading to a higher edition of Windows.

Here are some common scenarios for image servicing and management: Tasks

Capture an image and save it as a .wim file. List all images within a .wim, .vhd, or .vhdx file. Manage several images in a single .wim file by appending, removing, or

enumerating the images. Prepare a Windows PE image. List information about a Windows PE image. Mount a Windows image. List specific information about an image mounted from a .wim, .vhd, or .vhdx file,

including where it is mounted, the mount status, and the index of each image in a .wim file.

List all drivers in an image or information about a specific driver. Add out-of-box or boot-critical drivers to support new hardware. Add operating-system updates such as hotfixes and Windows features. Add or remove a language pack, and configure international settings. List all international settings and languages in an image. Troubleshooting through integrated status and logging. Manage multiple image versions. List all features in a package or specific information about a Windows feature. Check the applicability of a Windows® Installer.msp file. Update multiple Windows editions by updating a single image. Upgrade to a higher edition of Windows. List all of the Windows editions that an image can be upgraded to. Apply settings in an Unattend.xml answer file. Split a large .wim file into several smaller files to fit on selected media.

2 | P a g e

Page 3: Append-Image · Web viewThis argument is available only for Windows PE images. Only one volume image can be marked as bootable in a .wim file. /CheckIntegrity detects and tracks

ONLINE COMMANDS/Append-Image........................................................................................................4

/Apply-Image...........................................................................................................4

/Capture-Image........................................................................................................5

/Cleanup-Mountpoints............................................................................................5

/Commit-Image........................................................................................................6

/Delete-Image..........................................................................................................6

/Export-Image..........................................................................................................8

/Get-MountedImageInfo.........................................................................................8

/Get-ImageInfo........................................................................................................9

/List-Image...............................................................................................................9

/Mount-Image..........................................................................................................9

/Remount-Image....................................................................................................10

/Split-Image...........................................................................................................10

/Unmount-Image...................................................................................................11

OFFLINE SERVICING/Get-Help

/Log-Path:

/LogLevel: n

/Image:

/WinDir:

/Online

/SysDriverDir

/Quiet

/NoRestart

/ScratchDir:

/English

The base syntax for DISM is as follows:DISM {/Image:path_to_offline_image_directory | /Online} [dism_options] {servicing_command} [servicing_argument]

3 | P a g e

Page 4: Append-Image · Web viewThis argument is available only for Windows PE images. Only one volume image can be marked as bootable in a .wim file. /CheckIntegrity detects and tracks

Option Argument Description

/APPEND-IMAGE /ImageFile: <path_to_image_file>/CaptureDir: <source_directory>/Name: <image_name>[/Description:<image_description>][/ConfigFile:<configuration_file.ini>][/Bootable][/CheckIntegrity][/Verify][/NoRpFix]

Adds an additional image to a .wim file. /ConfigFile specifies the location of a configuration file that lists exclusions for image capture and compress commands./Bootable marks a volume image as being a bootable image. This argument is available only for Windows PE images. Only one volume image can be marked as bootable in a .wim file./CheckIntegrity detects and tracks .wim file corruption when used with capture, unmount, export, and commitoperations./CheckIntegrity stops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations./Verify checks for errors and file duplication./NoRpFix disables the reparse point tag fix. A reparse point is a file that contains a link to another file on the file system. If/NoRpFix is not specified, reparse points that resolve to paths outside of the value specified by /ImageFile are not be captured.

/APPLY-IMAGE /ImageFile: <path_to_image_file>[/SWMFile:<pattern>]/ApplyDir: <target_directory>{/Index:< image_index> | /Name:<image_name>}[/CheckIntegrity][/Verify][/NoRpFix]

Applies an image to a specified drive.This command-line option does not apply to virtual hard disk (VHD) files./SWMFile enables you to reference split .wim files (SWMs). <pattern> is the naming pattern and location of split files. You can also specify wildcard characters. For example, "E:\image\install*.swm" applies all of the split files in the E:\image directory named install1.swm, install2.swm, and so on./CheckIntegrity detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations./CheckIntegrity stops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations./Verify checks for errors and file duplication./NoRpFix disables the reparse point tag fix. A reparse point is a file that contains a link to another file on the file system. If/NoRpFix is not specified, reparse points that resolve to paths outside of the value specified by /ImageFile are not be captured.

4 | P a g e

Page 5: Append-Image · Web viewThis argument is available only for Windows PE images. Only one volume image can be marked as bootable in a .wim file. /CheckIntegrity detects and tracks

/CAPTURE-IMAGE /ImageFile: <path_to_image_file>/CaptureDir: <source_directory>/Name: <image_name>[/Description: <image_description>][/ConfigFile: <configuration_file.ini>][/Compress:{max|fast|none}][/Bootable][/CheckIntegrity][/Verify][/NoRpFix]

Captures an image of a drive to a new .wim file. Captured directories include all subfolders and data. You cannot capture an empty directory. A directory must contain at least one file.This command-line option does not apply to virtual hard disk (VHD) files.

Important:DISM does not support extended attributes. DISM ignores extended attributes during a capture operation./ConfigFile specifies the location of a configuration file that lists exclusions for image capture and compress commands./Compress specifies the type of compression used for the initial capture operation. The maximum option provides the best compression, but takes more time to capture the image. The fast option provides faster image compression, but the resulting files are larger than those compressed by using the maximum option. This is also the default compression type that is used if you do not specify the argument. The none option does not compress the captured image at all./Bootable marks a volume image as being a bootable image. This argument is available only for Windows PE images. Only one volume image can be marked as bootable in a .wim file./CheckIntegrity detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. /CheckIntegrity stops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations./Verify checks for errors and file duplication./NoRpFix disables the reparse point tag fix. A reparse point is a file that contains a link to another file on the file system. If /NoRpFix is not specified, reparse points that resolve to paths outside of the value specified by /ImageFile are not be captured.Dism /Capture-Image /ImageFile:install.wim /CaptureDir:D:\ /Name:Drive-D

/CLEANUP-MOUNTPOINTS

Deletes all of the resources associated with a mounted image that has been corrupted.This command will not unmount images that are already mounted, nor will it delete images that can be recovered using the /Remount-Image command.Dism /Cleanup-Mountpoints

5 | P a g e

Page 6: Append-Image · Web viewThis argument is available only for Windows PE images. Only one volume image can be marked as bootable in a .wim file. /CheckIntegrity detects and tracks

/COMMIT-IMAGE /MountDir: <path_to_mount_directory>[/CheckIntegrity][/Append]

Applies the changes that you have made to the mounted image.The image remains mounted until the /Unmount-Image option is used./CheckIntegrity detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. /CheckIntegritystops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations./Append adds the modified image to the existing .wim file instead of overwriting the original image.The /CheckIntegrity and /Append arguments do not apply to virtual hard disk (VHD) files.Dism /Commit-Image /MountDir:C:\test\offline

/DELETE-IMAGE /ImageFile: <path_to_image_file>{/Index:<image_index> |/Name:<image_name>}[/CheckIntegrity]

Deletes the specified volume image from a .wim file that has multiple volume images.This option deletes only the metadata entries and XML entries. It does not delete the stream data and does not optimize the .wim file.This command-line option does not apply to virtual hard disk (VHD) files./CheckIntegrity detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. /CheckIntegritystops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations.Dism /Delete-Image /ImageFile:install.wim /Index:1

6 | P a g e

Page 7: Append-Image · Web viewThis argument is available only for Windows PE images. Only one volume image can be marked as bootable in a .wim file. /CheckIntegrity detects and tracks

7 | P a g e

Page 8: Append-Image · Web viewThis argument is available only for Windows PE images. Only one volume image can be marked as bootable in a .wim file. /CheckIntegrity detects and tracks

/EXPORT-IMAGE {/SourceImageFile:<path_to_image_file>| /SWMFile:<pattern>}{/SourceIndex:<image_index> |/SourceName:<image_name>}/DestinationImageFile:<path_to_image_file>[/DestinationName:<name>][/Compress:{max | fast | none}][/Bootable][/CheckIntegrity]

Exports a copy of the specified image to another file. The source and destination files must use the same compression type. You can also optimize an image by exporting to a new image file. When you modify an image, DISM stores additional resource files that increase the overall size of the image. Exporting the image will remove unnecessary resource files.This command-line option does not apply to virtual hard disk (VHD) files./SWMFile enables you to reference split .wim files. pattern is the naming pattern and location of split files. You can also specify wildcard characters. For example, "E:\image\install*.swm" will export the split files in the E:\image directory named install1.swm, install2.swm, and so on./Compress specifies the type of compression used for the initial capture operation. The maximum option provides the best compression, but takes more time to capture the image. The fast option provides faster image compression, but the resulting files are larger than those compressed by using the maximum option. This is also the default compression type that is used if you do not specify the argument. Thenone option does not compress the captured image at all./Bootable marks a volume image as being a bootable image. This argument is available only for Windows PE images. Only one volume image can be marked as bootable in a .wim file./CheckIntegrity detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. /CheckIntegritystops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations.Dism /Export-Image /SourceImageFile:install.wim /SourceIndex:1 /DestinationImageFile:install2.wim

/GET-MOUNTEDIMAGEINFO

Lists the images that are currently mounted and information about the mounted image such as whether the image is valid, read/write permissions, mount location, mounted file path, and mounted image index.Dism /Get-MountedImageInfo

/GET-IMAGEINFO Displays information about the images that are contained in

8 | P a g e

Page 9: Append-Image · Web viewThis argument is available only for Windows PE images. Only one volume image can be marked as bootable in a .wim file. /CheckIntegrity detects and tracks

/ImageFile: <path_to_image_file>{/Index:<image_index> | /Name:<image_name>}

the .wim, vhd or .vhdx file. When used with the /Index or /Name argument, information about the specified image is displayed. The /Name argument does not apply to VHD files. You must specify /Index:1 for VHD files.Dism /Get-ImageInfo /ImageFile:C:\test\offline\install.wimDism /Get-ImageInfo /ImageFile:C:\test\images\myimage.vhd /Index:1

/LIST-IMAGE /ImageFile: <path_to_image_file>{/Index:<image_index> | /Name:<image_name>}

Displays a list of the files and folders in a specified image.This command-line option does not apply to virtual hard disk (VHD) files.Dism /List-Image /ImageFile:install.wim /Index:1

/MOUNT-IMAGE /ImageFile: <path_to_image_file>{/Index:<image_index> | /Name:<image_name>}/MountDir: <path_to_mount_directory>[/ReadOnly][/Optimize][/CheckIntegrity]

Mounts an image from a .wim, .vhd or .vhdx file to the specified directory so that it is available for servicing./ReadOnly sets the mounted image with read-only permissions.You can use /Optimize to reduce initial mount time.

Important:

When using the/Optimize argument, processes that are ordinarily performed during a mount will instead be completed the first time that you access a directory. As a result, there may be an increase in the time that is required to access a directory for the first time after mounting an image using the /Optimize argument./CheckIntegrity detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. /CheckIntegritystops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations.Dism /Mount-Image /ImageFile:C:\test\images\myimage.wim /Index:1 /MountDir:C:\test\offlineDism /Mount-Image /ImageFile:C:\test\images\myimage.vhd /Index:1 /MountDir:C:\test\offline /ReadOnly

9 | P a g e

Page 10: Append-Image · Web viewThis argument is available only for Windows PE images. Only one volume image can be marked as bootable in a .wim file. /CheckIntegrity detects and tracks

/REMOUNT-IMAGE /MountDir: <path_to_mount_directory>

Remounts a mounted image that has become inaccessible and makes it available for servicing.Dism /Remount-Image /MountDir:C:\test\offline

/SPLIT-IMAGE /ImageFile: <path_to_image_file>/SWMFile: <path_to_swm>/FileSize: <size_in_MB>[/CheckIntegrity]

Splits an existing .wim file into multiple read-only split .wim files.This option creates the .swm files in the specified directory, naming each file the same as the specified <path_to_swm>, but with an appended number. For example, if you set <path_to_swm> as c:\Data.wim, this option creates a Data.swm file, a Data2.swm file, a Data3.swm file, and so on, defining each portion of the split .wim file and saving it to the C:\ directory.This command-line option does not apply to virtual hard disk (VHD) files./FileSize specifies the maximum size in megabytes (MB) for each created file.

Note:

If a single file is larger than the value specified in the /FileSize option, one of the split .swm files that results will be larger than the value specified in the /FileSize option, in order to accommodate the large file/CheckIntegrity detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. /CheckIntegritystops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations.Dism /Split-Image /ImageFile:install.wim /SWMFile:split.swm /FileSize:650

10 | P a g e

Page 11: Append-Image · Web viewThis argument is available only for Windows PE images. Only one volume image can be marked as bootable in a .wim file. /CheckIntegrity detects and tracks

/UNMOUNT-IMAGE /MountDir: <path_to_mount_directory>{/Commit | /Discard}[/CheckIntegrity][/Append]

Unmounts the .wim, .vhd or .vhdx file and either commits or discards the changes that were made when the image was mounted.You must use either the /Commit or /Discard argument when you use the /Unmount-Image option./CheckIntegrity detects and tracks .wim file corruption when used with capture, unmount, export, and commit operations. /CheckIntegritystops the operation if DISM detects that the .wim file is corrupted when used with apply and mount operations./Append adds the modified image to the existing .wim file instead of overwriting the original image.The /CheckIntegrity and /Append arguments do not apply to virtual hard disk (VHD) files.Dism /Unmount-Image /MountDir:C:\test\offline /CommitDism /Unmount-Image /MountDir:C:\test\offline /Discard

OFFLINE SERVICINGOption Description

/Get-Help [{/Image:path_to_offline_image_directory| /Online | /command-line_option} ]/?{/Image:path_to_offline_image_directory| /Online | /command-line_option} ]

Displays information about available DISM command-line options and arguments.The options available for servicing an image depend on the servicing technology available in your image. Specifying an image, either offline or online, will generate information about the specific options that are available for that image.You can also display additional help by specifying a command-line option.

/Log-Path: path_to_log_file.log

Specifies the full path and file name to log to. If not set, the default is %WINDIR%\Logs\Dism\dism.log.

Note:In Windows PE 4.0, the default directory is the

11 | P a g e

Page 12: Append-Image · Web viewThis argument is available only for Windows PE images. Only one volume image can be marked as bootable in a .wim file. /CheckIntegrity detects and tracks

RAMDISK scratch space, which can be as low as 23 MB.The log file is automatically archived. The archived log file is saved with .bak appended to the file name, and a new log file is generated. Each time the log file is archived, the .bak file will be overwritten.When using a network share that is not joined to a domain, use the net use command with domain credentials to set access permissions before you set the log path for the DISM log.

/LogLevel: n Specifies the maximum output level shown in the logs. The default log level is 3. The following values are accepted:1 = Errors only2 = Errors and warnings3 = Errors, warnings, and informational output4 = All of the previously mentioned values, plus debug output

/Image: path_to_offline_image_directory

This is the full path to the root directory of the offline Standard 8 image that you will service. If the directory named Windows is not a subdirectory of the root directory, /WinDir must be specified.This option cannot be used with /Online.

/WinDir: path_to_%WINDIR%

Used with the /Image option to specify the path to the Standard 8 directory relative to the image path. This cannot be the full path to the Windows directory; it should be a relative path. If not specified, the default is the Windows directory in the root of the offline image directory.This option cannot be used with the /Online option.

/Online Specifies that the action is to be taken on the operating system that is currently running.This option cannot be used with the /Image or the /WinDir options. When /Online is used, the Windows directory for the online image is automatically detected.

12 | P a g e

Page 13: Append-Image · Web viewThis argument is available only for Windows PE images. Only one volume image can be marked as bootable in a .wim file. /CheckIntegrity detects and tracks

13 | P a g e

Page 14: Append-Image · Web viewThis argument is available only for Windows PE images. Only one volume image can be marked as bootable in a .wim file. /CheckIntegrity detects and tracks

/SysDriverDir:path_to_sysdrive_directory

Specifies the path to the location of the BootMgr files. This is necessary only when the BootMgr files are located on a partition other than the one containing the Windows directory and when the BootMgr files need to be serviced.This option is not necessary if you are servicing an applied image, because system partitions are not part of the WIM file.

/Quiet Turns off informational and progress output to the console. Only error messages will be displayed.To run in quiet mode, this option must be set every time that the command-line utility is run. It must be present before the servicing command.

Note:Do not use the /Quiet option with the /Get commands. No information will be displayed.

/NoRestart Suppresses restarting. If a restart is not necessary, then this command does nothing. This option will keep the application from prompting for a restart (or keep it from restarting automatically if the /Quiet option is used).

/ScratchDir: path_to_scratch_directory

Specifies a temporary directory to be used when extracting files for temporary use during servicing. The directory must exist locally. If not specified, the \Windows\%Temp% directory will be used, with a subdirectory name created from a randomly generated hexadecimal value for each run of DISM. Items in the scratch directory are deleted after each operation.You should not use a network share location as a scratch directory to expand a CBS package (.cab or .msu file) for installation. The directory used for extracting files for temporary use during servicing should be a local directory.

14 | P a g e

Page 15: Append-Image · Web viewThis argument is available only for Windows PE images. Only one volume image can be marked as bootable in a .wim file. /CheckIntegrity detects and tracks

/English Displays the command-line output in English.Note:

Some resources cannot be displayed in English.This option is not supported when using the DISM /? command.

15 | P a g e

Page 16: Append-Image · Web viewThis argument is available only for Windows PE images. Only one volume image can be marked as bootable in a .wim file. /CheckIntegrity detects and tracks

DISM POWERSHELL COMMANDSCmdlet Description

Add-AppxProvisionedPackage Adds an app package (.appx) that will install for each new user to a Windows image.

Add-WindowsDriver Adds a driver to an offline Windows image.

Add-WindowsPackage Adds a single .cab or .msu file to a Windows image.

Clear-WindowsCorruptMountPoint

Deletes all of the resources that are associated with a mounted image that has been corrupted.

Disable-WindowsOptionalFeature

Disables a feature in a Windows image.

Dismount-WindowsImage Dismounts a Windows image from the directory that it is mapped to.

Enable-WindowsOptionalFeature

Enables a feature in a Windows image.

Get-AppxProvisionedPackage Gets information about app packages (.appx) in an image that are set to install for each new user.

Get-WindowsDriver Gets information about drivers in a Windows image.

Get-WindowsEdition Gets edition information about a Windows image.

Get-WindowsImage Gets information about a Windows image in a WIM or VHD file.

Get-WindowsOptionalFeature Gets information about optional features in a Windows image.

Get-WindowsPackage Gets information about packages in a Windows image.

16 | P a g e

Page 17: Append-Image · Web viewThis argument is available only for Windows PE images. Only one volume image can be marked as bootable in a .wim file. /CheckIntegrity detects and tracks

Mount-WindowsImage Mounts a Windows image in a WIM or VHD file to a directory on the local computer.

Remove-AppxProvisionedPackage

Removes app packages (.appx) from a Windows image.

Remove-WindowsDriver Removes a driver from an offline Windows image.

Remove-WindowsPackage Removes a package from a Windows image.

Repair-WindowsImage Repairs a Windows image in a WIM or VHD file.

Save-WindowsImage Applies changes made to a mounted image to its WIM or VHD file.

Set-WindowsEdition Changes a Windows image to a higher edition.

Set-WindowsProductKey Sets the product key for the Windows image.

Use-WindowsUnattend Applies an unattended answer file to a Windows image.

17 | P a g e