다음을 통해 공유


Use DISM in Windows PowerShell

Applies To: Windows 8, Windows 8.1, Windows Server 2012, Windows Server 2012 R2

The Deployment Image Servicing and Management (DISM) cmdlets can be used to perform the same functions as the DISM.exe command-line tool. In many cases, the DISM cmdlet names correspond directly to Dism.exe options and the same arguments can be used. Because there are also cases where the DISM cmdlet names do not correspond directly to Dism.exe options, a table that maps the Dism.exe commands to DISM cmdlets is provided here:

Dism.exe command DISM cmdlet

Dism.exe /Append-Image

Add-WindowsImage

Dism.exe /Apply-Image

Expand-WindowsImage

Dism.exe /Capture-Image

New-WindowsImage

Dism.exe /Cleanup-MountPoints

Clear-WindowsCorruptMountPoint

Dism.exe /Commit-Image

Save-WindowsImage

Dism.exe /Export-Image

Export-WindowsImage

Dism.exe /Get-ImageInfo

Get-WindowsImage

Dism.exe /Get-MountedImageInfo

Get-WindowsImage -Mounted

Dism.exe /Get-WimBootEntry

Get-WIMBootEntry

Dism.exe /List-Image

Get-WindowsImageContent

Dism.exe /Mount-Image

Mount-WindowsImage

Dism.exe /Split-Image

Split-WindowsImage

Dism.exe /Remove-Image

Remove-WindowsImage

Dism.exe /Remount-Image

Mount-WindowsImage -Remount

Dism.exe /Unmount-Image

Dismount-WindowsImage

Dism.exe /Update-WimBootEntry

Update-WIMBootEntry

Dism.exe /Image:<…> /Add-Driver

Add-WindowsDriver

Dism.exe /Image:<...> /Add-Package

Add-WindowsPackage

Dism.exe /Image:<...> /Add-ProvisionedAppxPackage

Add-AppxProvisionedPackage

Dism.exe /Image:<...> /Apply-Unattend

Apply-WindowsUnattend

Dism.exe /Image:<...> /Cleanup-Image /CheckHealth

Repair-WindowsImage -CheckHealth

Dism.exe /Image:<...> /Cleanup-Image /ScanHealth

Repair-WindowsImage –ScanHealth

Dism.exe /Image:<...> /Cleanup-Image /RestoreHealth

Repair-WindowsImage –RestoreHealth

Dism.exe /Image:<...> /Disable-Feature

Disable-WindowsOptionalFeature

Dism.exe /Image:<...> /Enable-Feature

Enable-WindowsOptionalFeature

Dism.exe /Image:<...> /Export-Driver

Export-WindowsDriver

Dism.exe /Image:<...> /Get-CurrentEdition

Get-WindowsEdition -Current

Dism.exe /Image:<...> /Get-Driverinfo

Get-WindowsDriver -Driver

Dism.exe /Image:<...> /Get-Drivers

Get-WindowsDriver

Dism.exe /Image:<...> /Get-Featureinfo

Get-WindowsOptionalFeature -FeatureName

Dism.exe /Image:<...> /Get-Features

Get-WindowsOptionalFeature

Dism.exe /Image:<...> /Get-Packageinfo

Get-WindowsPackage -PackagePath | -PackageName

Dism.exe /Image:<...> /Get-Packages

Get-WindowsPackage

Dism.exe /Image:<...> /Get-ProvisionedAppxPackages

Get-AppxProvisionedPackage

Dism.exe /Image:<...> /Get-TargetEditions

Get-WindowsEdition -Target

Dism.exe /Image:<...> /Optimize-Image

Optimize-WindowsImage

Dism.exe /Image:<...> /Remove-Driver

Remove-WindowsDriver

Dism.exe /Image:<...> /Remove-Package

Remove-WindowsPackage

Dism.exe /Image:<...> /Remove-ProvisionedAppxPackage

Remove-AppxProvisionedPackage

Dism.exe /Image:<...> /Set-Edition

Set-WindowsEdition

Dism.exe /Image:<...> /Set-ProductKey

Set-WindowsProductKey

Dism.exe /Image:<...> /Set-ProvisionedAppxDataFile

Set-AppXProvisionedDataFile

Install the Windows Assessment and Deployment Kit (Optional)

  • The DISM PowerShell module is included in Windows 8.1 and Windows Server 2012 R2. On other supported operating systems, you can install the Windows Assessment and Deployment Kit (Windows ADK) which includes the DISM PowerShell module. For more information, see Installing the Windows ADK.

Install Windows PowerShell 4.0

  • For Windows 8.1 and Windows Server 2012 R2, Windows PowerShell 4.0 is included in the installation. For other supported versions of Windows and Windows Server, (including Windows 8, Windows 7 SP1, Windows Server 2012, and Windows Server 2008 R2 SP1), you must install Windows Management Framework 4.0. You can download and install Windows Management Framework 4.0 from the Microsoft Download Center.

To prepare the DISM PowerShell Environment

  1. To open PowerShell with administrator privileges, on the Start screen, type PowerShell, right-click the Windows PowerShell app tile, and then, in the app bar, click Run as administrator.

  2. Import the DISM PowerShell module.

    The DISM PowerShell module is included in Windows 8.1 and Windows Server 2012 R2 and does not need to be imported.

    On other supported operating systems, you can use the DISM PowerShell module included in the Windows ADK. By default, the module is installed with the Windows ADK in the DISM folder at <x86 or amd64>\DISM\ under the path: C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\, in Windows 8.1, and C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Deployment Tools\, in Windows 8. To import this module, at the command prompt, type:

    import-module <path to DISM folder>
    

    For example, using the Windows 8.1 version of the Windows ADK on a 64-bit PC type:

    import-module "C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\amd64\DISM"
    

Note

Import-Module imports a module only into the current session. To import the module into all sessions, add an Import-Module command to your Windows PowerShell profile. For more information about profiles, type get-help about_profiles.

  1. Set the %path% environment variable to the location of the DISM folder in the Windows ADK installation. At the command prompt, type:

    $env:path = <path to DISM folder>
    

    When you change environment variables in Windows PowerShell, the change affects only the current session. To make a persistent change to an environment variable that stores the change in the registry, use System in Control Panel. For more information, see To add or change the values of environment variables.

To get Help for DISM PowerShell cmdlets

  1. To get the syntax to use with a cmdlet, at a command prompt, type:

    get-help <cmdlet name>
    

    For example, type:

    get-help get-WindowsImage
    

See Also

Reference

DISM Supported Platforms

Other Resources

DISM - Deployment Image Servicing and Management Technical Reference