DISM命令(Deployment Image Servicing and Management)是Windows操作系统中的一个工具,它可以对映像文件进行操作和维护。主要用于管理Windows镜像、软件包和驱动程序

DISM(Deployment Image Servicing and Management)是Windows操作系统中的一个工具,它可以对映像文件进行操作和维护。主要用于管理Windows镜像、软件包和驱动程序。

dism /?

Deployment Image Servicing and Management tool
Version: 10.0.20348.681


DISM.exe [dism_options] {Imaging_command} [<Imaging_arguments>]
DISM.exe {/Image:<path_to_offline_image> | /Online} [dism_options]
         {servicing_command} [<servicing_arguments>]

DESCRIPTION:

  DISM enumerates, installs, uninstalls, configures, and updates features
  and packages in Windows images. The commands that are available depend
  on the image being serviced and whether the image is offline or running.


FFU COMMANDS:

  /Capture-Ffu            - Captures a physical disk image into a new FFU file.
  /Apply-Ffu              - Applies an .ffu image.
  /Split-Ffu              - Splits an existing .ffu file into multiple read-only
                            split FFU files.
  /Optimize-Ffu           - Optimizes a FFU file so that it can be applied to storage
                            of a different size.

WIM COMMANDS:

  /Apply-CustomDataImage  - Dehydrates files contained in the custom data image.
  /Capture-CustomImage    - Captures customizations into a delta WIM file on a
                            WIMBoot system. Captured directories include all
                            subfolders and data.
  /Get-WIMBootEntry       - Displays WIMBoot configuration entries for the
                            specified disk volume.
  /Update-WIMBootEntry    - Updates WIMBoot configuration entry for the
                            specified disk volume.
  /List-Image             - Displays a list of the files and folders in a
                            specified image.
  /Delete-Image           - Deletes the specified volume image from a WIM file
                            that has multiple volume images.
  /Export-Image           - Exports a copy of the specified image to another
                            file.
  /Append-Image           - Adds another image to a WIM file.
  /Capture-Image          - Captures an image of a drive into a new WIM file.
                            Captured directories include all subfolders and
                            data.
  /Get-MountedWimInfo     - Displays information about mounted WIM images.
  /Get-WimInfo            - Displays information about images in a WIM file.
  /Commit-Wim             - Saves changes to a mounted WIM image.
  /Unmount-Wim            - Unmounts a mounted WIM image.
  /Mount-Wim              - Mounts an image from a WIM file.
  /Remount-Wim            - Recovers an orphaned WIM mount directory.
  /Cleanup-Wim            - Deletes resources associated with mounted WIM
                            images that are corrupted.

GENERIC IMAGING COMMANDS:

  /Split-Image            - Splits an existing .wim file into multiple
                            read-only split WIM (SWM) files.
  /Apply-Image            - Applies an image.
  /Get-MountedImageInfo   - Displays information about mounted WIM and VHD
                            images.
  /Get-ImageInfo          - Displays information about images in a WIM, a VHD
                            or a FFU file.
  /Commit-Image           - Saves changes to a mounted WIM or VHD image.
  /Unmount-Image          - Unmounts a mounted WIM or VHD image.
  /Mount-Image            - Mounts an image from a WIM or VHD file.
  /Remount-Image          - Recovers an orphaned image mount directory.
  /Cleanup-Mountpoints    - Deletes resources associated with corrupted
                            mounted images.

IMAGE SPECIFICATIONS:

  /Online                 - Targets the running operating system.
  /Image                  - Specifies the path to the root directory of an
                            offline Windows image.

DISM OPTIONS:

  /English                - Displays command line output in English.
  /Format                 - Specifies the report output format.
  /WinDir                 - Specifies the path to the Windows directory.
  /SysDriveDir            - Specifies the path to the system-loader file named
                            BootMgr.
  /LogPath                - Specifies the logfile path.
  /LogLevel               - Specifies the output level shown in the log (1-4).
  /NoRestart              - Suppresses automatic reboots and reboot prompts.
  /Quiet                  - Suppresses all output except for error messages.
  /ScratchDir             - Specifies the path to a scratch directory.

For more information about these DISM options and their arguments, specify an
option immediately before /?.

  Examples:
    DISM.exe /Mount-Wim /?
    DISM.exe /ScratchDir /?
    DISM.exe /Image:C:\test\offline /?
    DISM.exe /Online /?

dism /?

部署映像服务和管理工具
版本:10.0.20348.681

DISM.exe [dism选项] {映像命令} [<映像参数>]
DISM.exe {/Image:<离线映像路径> | /Online} [dism选项]
{维护命令} [<维护参数>]

描述:

DISM 用于列举、安装、卸载、配置和更新 Windows 映像中的功能和软件包。可用的命令取决于正在维护的映像以及映像是离线还是在线的。

FFU 命令:

/Capture-Ffu            - 将物理磁盘映像捕获到新的 FFU 文件中。
/Apply-Ffu              - 应用 .ffu 映像。
/Split-Ffu              - 将现有的 .ffu 文件拆分为多个只读分割的 FFU 文件。
/Optimize-Ffu           - 优化 FFU 文件,以便将其应用于不同大小的存储。

WIM 命令:

/Apply-CustomDataImage  - 将包含在自定义数据映像中的文件去水化。
/Capture-CustomImage    - 在 WIMBoot 系统中将定制内容捕获到增量 WIM 文件中。捕获的目录包括所有子文件夹和数据。
/Get-WIMBootEntry       - 显示指定磁盘卷的 WIMBoot 配置条目。
/Update-WIMBootEntry    - 更新指定磁盘卷的 WIMBoot 配置条目。
/List-Image             - 显示指定映像中的文件和文件夹列表。
/Delete-Image           - 从具有多个卷映像的 WIM 文件中删除指定的卷映像。
/Export-Image           - 将指定映像的副本导出到另一个文件。
/Append-Image           - 将另一个映像添加到 WIM 文件中。
/Capture-Image          - 将驱动器的映像捕获到新的 WIM 文件中。捕获的目录包括所有子文件夹和数据。
/Get-MountedWimInfo     - 显示有关已加载的 WIM 映像的信息。
/Get-WimInfo            - 显示 WIM 文件中映像的信息。
/Commit-Wim             - 将对已加载的 WIM 映像所做的更改保存。
/Unmount-Wim            - 卸载已加载的 WIM 映像。
/Mount-Wim              - 从 WIM 文件中加载映像。
/Remount-Wim            - 恢复孤立的 WIM 挂载目录。
/Cleanup-Wim            - 删除与已加载的 WIM 映像相关的资源,这些资源已损坏。

通用映像命令:

/Split-Image            - 将现有的 .wim 文件拆分为多个只读的分割 WIM (SWM) 文件。
/Apply-Image            - 应用映像。
/Get-MountedImageInfo   - 显示已加载的 WIM 和 VHD 映像的信息。
/Get-ImageInfo          - 显示 WIM、VHD 或 FFU 文件中的映像信息。
/Commit-Image           - 保存对已加载的 WIM 或 VHD 映像所做的更改。
/Unmount-Image          - 卸载已加载的 WIM 或 VHD 映像。
/Mount-Image            - 从 WIM 或 VHD 文件中加载映像。
/Remount-Image          - 恢复孤立的映像挂载目录。
/Cleanup-Mountpoints    - 删除与损坏的已加载映像相关的资源。

映像规范:

/Online                 - 针对正在运行的操作系统。
/Image                  - 指定离线 Windows 映像的根目录路径。

DISM 选项:

/English                - 以英语显示命令行输出。
/Format                 - 指定报告输出格式。
/WinDir                 - 指定 Windows 目录的路径。
/SysDriveDir            - 指定系统引导加载程序文件 BootMgr 的路径。
/LogPath                - 指定日志文件路径。
/LogLevel               - 指定日志中显示的输出级别(1-4)。
/NoRestart              - 抑制自动重新启动和重新启动提示。
/Quiet                  - 抑制除错误消息外的所有输出。
/ScratchDir             - 指定临时目录的路径。

有关这些 DISM 选项及其参数的更多信息,请在 /? 之前指定一个选项。

示例:
DISM.exe /Mount-Wim /?
DISM.exe /ScratchDir /?
DISM.exe /Image:C:\test\offline /?
DISM.exe /Online /?

DISM.exe /Online /?

Deployment Image Servicing and Management tool
Version: 10.0.20348.681

Image Version: 10.0.20348.2340


The following commands may be used to service the image:

OS UNINSTALL SERVICING COMMANDS:

  /Set-OSUninstallWindow  - Sets the OS Uninstall Window.
  /Get-OSUninstallWindow  - Gets the OS Uninstall Window.
  /Remove-OSUninstall     - Remove the OS Uninstall.
  /Initiate-OSUninstall   - Initiates the OS Uninstall

APPX 服务命令:

  /Get-NonRemovableAppPolicy - 列出配置为不能通过
                            企业策略删除的程序包系列。
  /Set-NonRemovableAppPolicy - 为指定的程序包系列设置
                            企业的不可删除策略。
  /Optimize-ProvisionedAppxPackages - 通过跨 appx 数据包硬链接相同文件
优化预配的 appx 占用空间。
  /Set-ProvisionedAppxDataFile - 将自定义数据放入指定的应用包
                                (.appx 或 .appxbundle)。
                                指定的应用程序包必须已在映像中。
  /Remove-ProvisionedAppxPackage - 从映像中删除应用包(.appx 或 .appxbundle)。
                                创建新的用户帐户时,将
                            不安装这些应用包。
  /Add-ProvisionedAppxPackage - 将应用包(.appx 或 .appxbundle)添加到映像
                                并将其设置为对每个新用户进行安装。
  /Get-ProvisionedAppxPackages - 显示有关映像中设置为对每个新用户进行
                                安装的应用包
                                (.appx 或 .appxbundle)的信息。

程序包服务命令:

  /Add-Package            - 向映像中添加程序包。
  /Remove-Package         - 从映像中删除程序包。
  /Enable-Feature         - 启用映像中的特定功能。
  /Disable-Feature        - 禁用映像中的特定功能。
  /Get-Packages           - 显示有关映像中所有程序包的信息。
  /Get-PackageInfo        - 显示有关特定程序包的信息。
  /Get-Features           - 显示有关程序包中所有功能的信息。
  /Get-FeatureInfo        - 显示有关特定功能的信息。
  /Cleanup-Image          - 对映像执行清理和恢复
                            操作。
  /Export-Source          - 将一组功能导出到新存储库中。
  /Add-Capability         - 将一个或多个功能添加到图像中。
  /Remove-Capability      - 从一个映像中删除功能。
  /Get-Capabilities       - 获取映像中的功能。
  /Get-CapabilityInfo     - 获取映像中功能的信息。
  /Get-ReservedStorageState - 获取保留存储空间的当前状态。
  /Set-ReservedStorageState - 设置保留存储空间的当前状态。

操作系统常规命令:

  /Optimize-Image         - 对脱机映像执行指定的
                            配置。

驱动程序服务命令:

  /Remove-Driver          - 从脱机映像中删除驱动程序包。
  /Add-Driver             - 向脱机映像中添加驱动程序包。
  /Get-DriverInfo         - 显示有关脱机映像中或正在运行的操作系统中的
                            特定驱动程序的信息。
  /Get-Drivers            - 显示有关脱机映像中或正在运行的操作系统中
                            的所有驱动程序的信息。
  /Export-Driver          - 从脱机映像或正在运行的操作系统
                            导出所有第三方驱动程序包。

应用程序服务命令:

  /Check-AppPatch         - 显示有关 MSP 修补程序是否适用于安装的映像的信息。
  /Get-AppPatchInfo       - 显示有关安装的 MSP 修补程序的信息。
  /Get-AppPatches         - 显示有关应用于所有安装的应用程序的所有
                            MSP 修补程序的信息。
  /Get-AppInfo            - 显示有关特定安装的 MSI 应用程序的信息。
  /Get-Apps               - 显示有关安装的所有 MSI 应用程序的信息。

默认关联命令:

  /Remove-DefaultAppAssociations - 删除 Windows 映像中的默认应用程序关联。
  /Import-DefaultAppAssociations - 向 Windows 映像导入一组
                            默认应用程序关联。
  /Get-DefaultAppAssociations - 显示 Windows 映像中默认应用程序关联的列表。
  /Export-DefaultAppAssociations - 从运行的操作系统导出
                                    默认的应用程序关联。

国际服务命令:

  /Set-SysUILang          - 设置安装的脱机映像中使用的
                            系统 UI 语言。
  /Set-LayeredDriver      - 设置键盘分层驱动程序。
  /Set-UILang             - 设置安装的脱机映像中使用的默认系统用户界面语言。
  /Set-UILangFallback     - 设置安装的脱机映像中系统用户界面的回退默认语言。
  /Set-UserLocale         - 设置安装的脱机映像中的用户区域设置。
  /Set-SysLocale          - 设置安装的脱机映像中的非 Unicode 程序的语言(也
                            称为系统区域设置)和字体设置。
  /Set-InputLocale        - 设置要在安装的脱机映像中使用的输入区域设置和
                            键盘布局。
  /Set-TimeZone           - 设置安装的脱机映像中的默认时区。
  /Set-AllIntl            - 设置安装的脱机映像中的所有国际设置。
  /Set-SKUIntlDefaults    - 将安装的脱机映像中的指定 SKU 语言的所有国际
                            设置都设置为默认值。
  /Gen-LangIni            - 生成新的 lang.ini 文件。
  /Set-SetupUILang        - 定义安装程序将使用的默认语言。
  /Get-Intl               - 显示有关国际设置和语言的信息。

无人参与服务命令:

  /Apply-Unattend         - 将无人参与文件应用于映像。

EDGE 服务命令:

  /Add-Edge               - 将 Microsoft Edge 添加到映像。

预配程序包服务命令:

  /Get-ProvisioningPackageInfo - 获取预配程序包的信息。
  /Add-ProvisioningPackage - 添加预配程序包。

WINDOWS 版本服务命令:

  /Set-ProductKey         - 设置脱机映像的产品密钥。
  /Get-TargetEditions     - 显示可以将映像升级到的
                            Windows 版本列表。
  /Get-CurrentEdition     - 显示当前映像的版本。
  /Set-Edition            - 将映像升级到较高的版本。

For more information about these servicing commands and their arguments,
specify a command immediately before /?.

     Examples:
         DISM.exe /Image:C:\test\offline /Apply-Unattend /?
         DISM.exe /Image:C:\test\offline /Get-Features /?
         DISM.exe /Online /Get-Drivers /?

DISM.exe /Online /?

Deployment Image Servicing and Management tool
Version: 10.0.20348.681

Image Version: 10.0.20348.2340


The following commands may be used to service the image:

OS UNINSTALL SERVICING COMMANDS:

  /Set-OSUninstallWindow  - Sets the OS Uninstall Window.
  /Get-OSUninstallWindow  - Gets the OS Uninstall Window.
  /Remove-OSUninstall     - Remove the OS Uninstall.
  /Initiate-OSUninstall   - Initiates the OS Uninstall

APPX 服务命令:

  /Get-NonRemovableAppPolicy - 列出配置为不能通过
                            企业策略删除的程序包系列。
  /Set-NonRemovableAppPolicy - 为指定的程序包系列设置
                            企业的不可删除策略。
  /Optimize-ProvisionedAppxPackages - 通过跨 appx 数据包硬链接相同文件
优化预配的 appx 占用空间。
  /Set-ProvisionedAppxDataFile - 将自定义数据放入指定的应用包
                                (.appx 或 .appxbundle)。
                                指定的应用程序包必须已在映像中。
  /Remove-ProvisionedAppxPackage - 从映像中删除应用包(.appx 或 .appxbundle)。
                                创建新的用户帐户时,将
                            不安装这些应用包。
  /Add-ProvisionedAppxPackage - 将应用包(.appx 或 .appxbundle)添加到映像
                                并将其设置为对每个新用户进行安装。
  /Get-ProvisionedAppxPackages - 显示有关映像中设置为对每个新用户进行
                                安装的应用包
                                (.appx 或 .appxbundle)的信息。

程序包服务命令:

  /Add-Package            - 向映像中添加程序包。
  /Remove-Package         - 从映像中删除程序包。
  /Enable-Feature         - 启用映像中的特定功能。
  /Disable-Feature        - 禁用映像中的特定功能。
  /Get-Packages           - 显示有关映像中所有程序包的信息。
  /Get-PackageInfo        - 显示有关特定程序包的信息。
  /Get-Features           - 显示有关程序包中所有功能的信息。
  /Get-FeatureInfo        - 显示有关特定功能的信息。
  /Cleanup-Image          - 对映像执行清理和恢复
                            操作。
  /Export-Source          - 将一组功能导出到新存储库中。
  /Add-Capability         - 将一个或多个功能添加到图像中。
  /Remove-Capability      - 从一个映像中删除功能。
  /Get-Capabilities       - 获取映像中的功能。
  /Get-CapabilityInfo     - 获取映像中功能的信息。
  /Get-ReservedStorageState - 获取保留存储空间的当前状态。
  /Set-ReservedStorageState - 设置保留存储空间的当前状态。

操作系统常规命令:

  /Optimize-Image         - 对脱机映像执行指定的
                            配置。

驱动程序服务命令:

  /Remove-Driver          - 从脱机映像中删除驱动程序包。
  /Add-Driver             - 向脱机映像中添加驱动程序包。
  /Get-DriverInfo         - 显示有关脱机映像中或正在运行的操作系统中的
                            特定驱动程序的信息。
  /Get-Drivers            - 显示有关脱机映像中或正在运行的操作系统中
                            的所有驱动程序的信息。
  /Export-Driver          - 从脱机映像或正在运行的操作系统
                            导出所有第三方驱动程序包。

应用程序服务命令:

  /Check-AppPatch         - 显示有关 MSP 修补程序是否适用于安装的映像的信息。
  /Get-AppPatchInfo       - 显示有关安装的 MSP 修补程序的信息。
  /Get-AppPatches         - 显示有关应用于所有安装的应用程序的所有
                            MSP 修补程序的信息。
  /Get-AppInfo            - 显示有关特定安装的 MSI 应用程序的信息。
  /Get-Apps               - 显示有关安装的所有 MSI 应用程序的信息。

默认关联命令:

  /Remove-DefaultAppAssociations - 删除 Windows 映像中的默认应用程序关联。
  /Import-DefaultAppAssociations - 向 Windows 映像导入一组
                            默认应用程序关联。
  /Get-DefaultAppAssociations - 显示 Windows 映像中默认应用程序关联的列表。
  /Export-DefaultAppAssociations - 从运行的操作系统导出
                                    默认的应用程序关联。

国际服务命令:

  /Set-SysUILang          - 设置安装的脱机映像中使用的
                            系统 UI 语言。
  /Set-LayeredDriver      - 设置键盘分层驱动程序。
  /Set-UILang             - 设置安装的脱机映像中使用的默认系统用户界面语言。
  /Set-UILangFallback     - 设置安装的脱机映像中系统用户界面的回退默认语言。
  /Set-UserLocale         - 设置安装的脱机映像中的用户区域设置。
  /Set-SysLocale          - 设置安装的脱机映像中的非 Unicode 程序的语言(也
                            称为系统区域设置)和字体设置。
  /Set-InputLocale        - 设置要在安装的脱机映像中使用的输入区域设置和
                            键盘布局。
  /Set-TimeZone           - 设置安装的脱机映像中的默认时区。
  /Set-AllIntl            - 设置安装的脱机映像中的所有国际设置。
  /Set-SKUIntlDefaults    - 将安装的脱机映像中的指定 SKU 语言的所有国际
                            设置都设置为默认值。
  /Gen-LangIni            - 生成新的 lang.ini 文件。
  /Set-SetupUILang        - 定义安装程序将使用的默认语言。
  /Get-Intl               - 显示有关国际设置和语言的信息。

无人参与服务命令:

  /Apply-Unattend         - 将无人参与文件应用于映像。

EDGE 服务命令:

  /Add-Edge               - 将 Microsoft Edge 添加到映像。

预配程序包服务命令:

  /Get-ProvisioningPackageInfo - 获取预配程序包的信息。
  /Add-ProvisioningPackage - 添加预配程序包。

WINDOWS 版本服务命令:

  /Set-ProductKey         - 设置脱机映像的产品密钥。
  /Get-TargetEditions     - 显示可以将映像升级到的
                            Windows 版本列表。
  /Get-CurrentEdition     - 显示当前映像的版本。
  /Set-Edition            - 将映像升级到较高的版本。

For more information about these servicing commands and their arguments,
specify a command immediately before /?.

     Examples:
         DISM.exe /Image:C:\test\offline /Apply-Unattend /?
         DISM.exe /Image:C:\test\offline /Get-Features /?
         DISM.exe /Online /Get-Drivers /?

 

C:\Users\Administrator>DISM.exe /Online /Get-Drivers /?

Deployment Image Servicing and Management tool
Version: 10.0.20348.681

Image Version: 10.0.20348.2340


/Get-Drivers [/Format:<output_format>] [/all]

  显示有关映像中驱动程序的信息。使用 /Format 选项为输出
  指定表或列表格式。如果 /Format 未指定,
  则输出的格式为列表。默认情况下,只显示全新驱动程序。
  使用 /all 开关可显示映像中所有驱动程序。

    示例:
      DISM.exe /Image:C:\test\offline /Get-Drivers
      DISM.exe /Image:C:\test\offline /Get-Drivers /all
      DISM.exe /Image:C:\test\offline /Get-Drivers /Format:Table

 

DISM.exe /Mount-Wim /?
Deployment Image Servicing and Management tool
Version: 10.0.20348.681

/Mount-Wim /WimFile:<path_to_WIM_file>
{/Index:<image_index> | /Name:<image_name>}
/MountDir:<target_mount_directory> [/ReadOnly] [/EA]

将 WIM 文件挂载到指定目录,以便进行维护。
使用 /ReadOnly 将挂载的映像设置为只读权限。
使用 /EA 进行带扩展属性的挂载。

示例:
  DISM.exe /Mount-Wim /WimFile:C:\test\images\myimage.wim /index:1
    /MountDir:C:\test\offline

  DISM.exe /Mount-Wim /WimFile:C:\test\images\myimage.wim /index:1
    /MountDir:C:\test\offline /ReadOnly

dism /online /Apply-Unattend /?

Deployment Image Servicing and Management tool
Version: 10.0.20348.681

Image Version: 10.0.20348.2340


/Apply-Unattend:<path_to_unattend.xml>

  将 unattend.xml 文件应用于脱机映像或正在运行的操作系统。

    示例:
      DISM.exe /Image:C:\test\offline /Apply-Unattend:C:\unattend.xml
      DISM.exe /Online /Apply-Unattend:C:\unattend.xml

下面是DISM命令的一些常见用法:

  1. 检查映像状态:
Copy Code
dism /Online /Cleanup-Image /CheckHealth
  1. 扫描映像并执行修复操作:
Copy Code
dism /Online /Cleanup-Image /ScanHealth
dism /Online /Cleanup-Image /RestoreHealth
  1. 卸载未使用的驱动程序:
Copy Code
dism /Online /Cleanup-Image /StartComponentCleanup
  1. 启用或禁用Windows功能:
Copy Code
dism /Online /Enable-Feature /FeatureName:Feature1,Feature2,...
dism /Online /Disable-Feature /FeatureName:Feature1,Feature2,...
  1. 添加或删除Windows更新:
Copy Code
dism /Online /Add-Package /PackagePath:C:\PackageFolder\Package1.cab
dism /Online /Remove-Package /PackagePath:C:\PackageFolder\Package1.cab
  1. 指定映像路径:
Copy Code
dism /Mount-Image /ImageFile:C:\test\image.wim /Index:1 /MountDir:C:\test\offline
  1. 取消挂载映像:
Copy Code
dism /Unmount-Image /MountDir:C:\test\offline /Discard

这些都是DISM命令的一些常见用法,但别忘了在使用前要先了解和确认相应的参数和语法。

  1. 在映像中添加驱动程序:
Copy Code
dism /Image:C:\test\offline /Add-Driver /Driver:C:\test\driver\driver.inf
  1. 显示或更改Windows产品密钥:
Copy Code
dism /Online /Get-CurrentEdition
dism /Online /Get-TargetEditions
dism /Online /Set-Edition:ServerStandard /ProductKey:xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
  1. 导出和导入映像:
Copy Code
dism /Export-Image /SourceImageFile:C:\test\image.wim /SourceIndex:1 /DestinationImageFile:C:\test\newimage.wim
dism /Import-Image /SourceImageFile:C:\test\newimage.wim /DestinationImageFile:C:\test\image.wim

总之,通过DISM命令,管理员可以在Windows操作系统中执行各种任务,如修复映像、安装软件包、扩展映像等。因此,熟悉并掌握DISM命令的使用方法是管理Windows系统的一个必要技能。

  1. 检查、清理和优化系统映像:
Copy Code
dism /Online /Cleanup-Image /CheckHealth
dism /Online /Cleanup-Image /ScanHealth
dism /Online /Cleanup-Image /RestoreHealth
dism /Online /Cleanup-Image /StartComponentCleanup
dism /Online /Cleanup-Image /SPSuperseded
  1. 查看和设置映像信息:
Copy Code
dism /Get-WimInfo /WimFile:C:\test\image.wim
dism /Get-ImageInfo /ImageFile:C:\test\offline\Windows\System32\WinSxS\wow64_microsoft-windows-wow64_31bf3856ad364e35_10.0.17134.1_none_c3d63cffc5c3a28d\wow64_microsoft-windows-wow64_31bf3856ad364e35_10.0.17134.1_none_c3d63cffc5c3a28d.manifest
dism /Set-Edition:ServerDataCenter /ProductKey:xxxxx-xxxxx-xxxxx-xxxxx-xxxxx /AcceptEula
  1. 禁用或启用Windows镜像更新:
Copy Code
dism /Online /Disable-Feature /FeatureName:MicrosoftWindowsPowerShellV2 /NoRestart
dism /Online /Enable-Feature /FeatureName:MicrosoftWindowsPowerShellV2 /All /Source:c:\test\features /LimitAccess
  1. 分发清单文件(只能在Windows PE中使用):
Copy Code
dism /Image:C:\test\WinPE\mount /Add-Package /PackagePath:C:\test\drivers\driver1.inf /PackagePath:C:\test\drivers\driver2.inf
dism /Image:C:\test\WinPE\mount /Add-ProvisionedAppxPackage /PackagePath:C:\test\app1.appx /PackagePath:C:\test\app2.appx

以上就是一些常见的DISM命令用法,可以帮助管理员更好地维护和管理Windows映像文件。但每个命令都有很多参数和选项,使用前需查看相应的文档或帮助文本以了解其详细信息。

  1. 在映像中添加或删除语言包:
Copy Code
dism /Online /Add-Package /PackagePath:C:\test\lp.cab
dism /Online /Remove-Package /PackageName:Microsoft-Windows-Client-LanguagePack-Package~_~en-US~_~0.0.1.0
  1. 更改映像中Windows组件的状态:
Copy Code
dism /Online /Disable-Feature /FeatureName:IE-Optional-amd64
dism /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:D:\sources\sxs
  1. 恢复映像的基本文件系统和目录结构:
Copy Code
dism /Apply-Image /ImageFile:C:\test\image.wim /Index:1 /ApplyDir:C:\test\mounted_image /CheckIntegrity
  1. 安装或卸载Windows更新程序:
Copy Code
dism /Online /Add-Package /PackagePath:C:\test\updates\update1.msu
dism /Online /Remove-Package /PackageName:Package_for_KB123456~31bf3856ad364e35~amd64~~10.0.1.2
  1. 更新、替换或还原匹配的Windows组件:
Copy Code
dism /Online /Cleanup-Image /RestoreHealth /Source:D:\sources\install.wim
dism /Online /Replace-Image /ImageFile:C:\test\image1.wim /Index:1 /ReplacementImageFile:C:\test\image2.wim /CheckIntegrity
dism /Online /Restore-Health /Source:D:\sources\sxs /LimitAccess
  1. 设置Windows PE的引导环境:
Copy Code
dism /Set-Bootable-USB:ON /ISOName:"WinPE" /ImageFile:C:\test\winpe.wim /USBDrive:F:

总之,DISM命令为Windows管理员提供了许多实用的功能,包括映像维护、组件安装、语言包管理、更新程序和驱动程序安装等。但在使用之前,请务必仔细阅读相关文档和帮助信息。

  1. 配置和设置Windows PE的网络连接:
Copy Code
dism /Add-NetworkDriver /Driver:C:\test\drivers\net1.inf /Recurse
dism /Set-ProxyServer:proxy.example.com:8080 /ProxyUserName:username /ProxyPassword:password
dism /Apply-Unattend /Image:C:\test\winpe.wim /unattend:C:\test\unattend.xml
  1. 设置映像的默认用户配置:
Copy Code
dism /Online /Set-UserDefaultLocation:C:\Users\Default\AppData\Local\Microsoft\Windows\WinX\Group2
dism /Online /Set-UserLocale:fr-FR
  1. 检查、修复和压缩映像文件系统:
Copy Code
dism /Online /Check-FileSignature /FilePath:C:\Windows\System32\notepad.exe
dism /Online /Cleanup-Image /StartComponentCleanup /ResetBase
dism /Online /Export-Image /SourceImageFile:C:\test\image.wim /SourceIndex:1 /DestinationImageFile:C:\test\exported_image.wim /Compress:max
  1. 在映像中配置Windows Defender:
Copy Code
dism /Online /Enable-Feature /FeatureName:Microsoft-Windows-Defender /All /NoRestart
dism /Online /Disable-Feature /FeatureName:Microsoft-Windows-Defender /NoRestart
dism /Online /Configure-Defender /Scan:Moderate /SignatureUpdateInterval:1 /OnAccessProtection:High /RealtimeProtection:Disable
  1. 处理系统文件:
Copy Code
dism /Online /Cleanup-Image /RestoreHealth /Source:d:\sources\install.wim /LimitAccess
sfc /scannow

这些DISM命令可以帮助管理员完成各种任务,包括网络设置、用户配置、文件系统操作、安全和防病毒等。管理员可以根据需要选择适当的命令和选项来优化和管理Windows映像文件。

  1. 显示映像的信息:
Copy Code
dism /Get-WimInfo /WimFile:D:\sources\install.wim
  1. 配置网络驱动程序:
Copy Code
dism /Add-Driver /Image:C:\test\mount /Driver:C:\test\drivers\net1.inf
dism /Get-DriverInfo /Image:C:\test\mount
  1. 为Windows PE添加驱动程序:
Copy Code
dism /Add-Driver /Image:C:\test\winpe.wim /Driver:C:\test\drivers\net1.inf /ForceUnsigned
  1. 单独获取驱动程序信息:
Copy Code
dism /Get-DriverInfo /Driver:C:\test\drivers\net1.inf
  1. 在映像中添加或删除软件包:
Copy Code
dism /Online /Add-Package /PackagePath:C:\test\updates\update1.msu
dism /Online /Remove-Package /PackageName:Package_for_KB123456~31bf3856ad364e35~amd64~~10.0.1.2

以上是一些常用的DISM命令,可以帮助管理员管理Windows映像文件、驱动程序、安装软件包等。这些命令使用方便,但需要管理员具备一定的技术知识和经验,才能避免出错并保证系统的稳定性和安全性。

  1. 使用DISM设置映像的默认语言和时区:
Copy Code
dism /Online /Set-TimeZone:"Pacific Standard Time"
dism /Online /Set-UILang:fr-FR
  1. 向映像中添加或删除驱动程序:
Copy Code
dism /Image:C:\test\mount /Add-Driver /Driver:C:\test\drivers\net1.inf
dism /Image:C:\test\mount /Remove-Driver /Driver:oem0.inf /ForceDeletion
  1. 为Windows PE添加自定义组件:
Copy Code
dism /Add-ProvisionedAppxPackage /PackagePath:C:\test\appx1.appx /SkipLicense
dism /Add-Package /PackagePath:C:\test\lp.cab /IgnoreCheck
  1. 在映像中清理不需要的系统文件:
Copy Code
dism /Online /Cleanup-Image /StartComponentCleanup /ResetBase /AnalyzeComponentStore
  1. DISM还支持压缩映像文件系统以减少文件大小。这可以通过以下命令完成:
Copy Code
Dism /Export-Image /SourceImageFile:install.wim /SourceIndex:1 /DestinationImageFile:new_install.wim /Compress:max

以上是一些常用的DISM命令,可以帮助管理员更好地管理Windows映像、驱动程序、软件包等,增强系统的安全性和可靠性。在使用这些命令时,请务必仔细查看命令选项和文档,以避免出现问题。

  1. DISM还可以用于修复Windows映像文件中的损坏和错误。以下是一些常用的修复命令:
Copy Code
dism /Online /Cleanup-Image /CheckHealth
dism /Online /Cleanup-Image /RestoreHealth /source:WIM:F:\sources\install.wim:1 /limitaccess
  1. 检查和设置驱动程序自动安装策略:
Copy Code
dism /Online /Get-DriverFeatures
dism /Online /Set-DriverFeatures /FeatureName:"WindowsUpdate" /FeatureName:"AllowRemoteRPC"
  1. 使用DISM禁用或启用Windows功能:
Copy Code
dism /Online /Disable-Feature /FeatureName:Microsoft-Hyper-V-All
dism /Online /Enable-Feature /FeatureName:SMB1Protocol
  1. 使用DISM升级或降级映像系统版本:
Copy Code
Dism /Online /Set-Edition:Professional /ProductKey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX /AcceptEula
Dism /Online /Set-Edition:Core /ProductKey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX /AcceptEula
  1. DISM还可以用于管理Windows PE映像文件和虚拟磁盘文件(VHD)。以下是一些常用的命令:
Copy Code
dism /Apply-Image /ImageFile:C:\test\winpe.wim /Index:1 /ApplyDir:C:\test\mount
dism /Commit-Wim /MountDir:C:\test\mount
dism /Capture-Image /ImageFile:C:\test\newimage.wim /CaptureDir:C:\test\mount /Name:"New Image"
dism /Mount-VHD /VhdFile:C:\test\test.vhd /Index:1 /MountDir:C:\test\mount

以上是一些常用的DISM命令,可以帮助管理员更好地管理Windows映像、驱动程序、软件包等,增强系统的安全性和可靠性。管理员可以根据需要选择适当的命令和选项来优化和管理Windows映像文件。在使用这些命令时,请务必仔细查看命令选项和文档,以避免出现问题。

  1. 使用DISM修复系统映像中的组件存储:
Copy Code
dism /Online /Cleanup-Image /StartComponentCleanup /ResetBase /AnalyzeComponentStore
  1. 使用DISM卸载更新程序包:
Copy Code
dism /Online /Remove-Package /PackageName:Package_for_KBxxxxxxx~yyyy.mm.mm~
  1. 使用DISM启用或禁用Windows Defender:
Copy Code
dism /Online /Disable-Feature /FeatureName:Windows-Defender
dism /Online /Enable-Feature /FeatureName:Windows-Defender
  1. 在Windows PE中添加驱动程序:
Copy Code
dism /Add-Driver /Image:C:\winpe\mount /Driver:C:\drivers\driver.inf
  1. 使用DISM禁用或启用特定功能:
Copy Code
dism /Online /Disable-Feature /FeatureName:IIS-WebServerRole
dism /Online /Enable-Feature /FeatureName:SMB1Protocol
  1. 挂载和卸载Windows映像文件:
Copy Code
dism /Mount-Wim /WimFile:C:\test\install.wim /Index:1 /MountDir:C:\test\mount
dism /Unmount-Wim /MountDir:C:\test\mount /Commit
  1. 使用DISM为Windows PE添加自定义驱动程序:
Copy Code
dism /Image:C:\winpe /Add-Driver /Driver:C:\drivers\driver.inf
  1. 使用DISM清理映像文件系统以减少文件大小:
Copy Code
dism /Export-Image /SourceImageFile:install.wim /SourceIndex:1 /DestinationImageFile:new_install.wim /Compress:max

以上是一些常用的DISM命令,可以帮助管理员更好地管理Windows映像、驱动程序、软件包等,增强系统的安全性和可靠性。管理员可以根据需要选择适当的命令和选项来优化和管理Windows映像文件。在使用这些命令时,请务必仔细查看命令选项和文档,以避免出现问题。

 

posted @ 2023-05-29 07:50  suv789  阅读(445)  评论(0编辑  收藏  举报