DISM命令(Deployment Image Servicing and Management)是Windows操作系统中的一个工具,它可以对映像文件进行操作和维护。主要用于管理Windows镜像、软件包和驱动程序
DISM(Deployment Image Servicing and Management)是Windows操作系统中的一个工具,它可以对映像文件进行操作和维护。主要用于管理Windows镜像、软件包和驱动程序。
dism /? Deployment Image Servicing and Management tool
DESCRIPTION: DISM enumerates, installs, uninstalls, configures, and updates features
/Capture-Ffu - Captures a physical disk image into a new FFU file. WIM COMMANDS: /Apply-CustomDataImage - Dehydrates files contained in the custom data image. GENERIC IMAGING COMMANDS: /Split-Image - Splits an existing .wim file into multiple IMAGE SPECIFICATIONS: /Online - Targets the running operating system. DISM OPTIONS: /English - Displays command line output in English. For more information about these DISM options and their arguments, specify an Examples: |
dism /? 部署映像服务和管理工具 DISM.exe [dism选项] {映像命令} [<映像参数>] 描述: DISM 用于列举、安装、卸载、配置和更新 Windows 映像中的功能和软件包。可用的命令取决于正在维护的映像以及映像是离线还是在线的。 FFU 命令: /Capture-Ffu - 将物理磁盘映像捕获到新的 FFU 文件中。 WIM 命令: /Apply-CustomDataImage - 将包含在自定义数据映像中的文件去水化。 通用映像命令: /Split-Image - 将现有的 .wim 文件拆分为多个只读的分割 WIM (SWM) 文件。 映像规范: /Online - 针对正在运行的操作系统。 DISM 选项: /English - 以英语显示命令行输出。 有关这些 DISM 选项及其参数的更多信息,请在 /? 之前指定一个选项。 示例: |
DISM.exe /Online /? Deployment Image Servicing and Management tool Image Version: 10.0.20348.2340
OS UNINSTALL SERVICING COMMANDS: /Set-OSUninstallWindow - Sets the OS Uninstall Window. APPX 服务命令: /Get-NonRemovableAppPolicy - 列出配置为不能通过 程序包服务命令: /Add-Package - 向映像中添加程序包。 操作系统常规命令: /Optimize-Image - 对脱机映像执行指定的 驱动程序服务命令: /Remove-Driver - 从脱机映像中删除驱动程序包。 应用程序服务命令: /Check-AppPatch - 显示有关 MSP 修补程序是否适用于安装的映像的信息。 默认关联命令: /Remove-DefaultAppAssociations - 删除 Windows 映像中的默认应用程序关联。 国际服务命令: /Set-SysUILang - 设置安装的脱机映像中使用的 无人参与服务命令: /Apply-Unattend - 将无人参与文件应用于映像。 EDGE 服务命令: /Add-Edge - 将 Microsoft Edge 添加到映像。 预配程序包服务命令: /Get-ProvisioningPackageInfo - 获取预配程序包的信息。 WINDOWS 版本服务命令: /Set-ProductKey - 设置脱机映像的产品密钥。 For more information about these servicing commands and their arguments, Examples: |
DISM.exe /Online /? Deployment Image Servicing and Management tool Image Version: 10.0.20348.2340
OS UNINSTALL SERVICING COMMANDS: /Set-OSUninstallWindow - Sets the OS Uninstall Window. APPX 服务命令: /Get-NonRemovableAppPolicy - 列出配置为不能通过 程序包服务命令: /Add-Package - 向映像中添加程序包。 操作系统常规命令: /Optimize-Image - 对脱机映像执行指定的 驱动程序服务命令: /Remove-Driver - 从脱机映像中删除驱动程序包。 应用程序服务命令: /Check-AppPatch - 显示有关 MSP 修补程序是否适用于安装的映像的信息。 默认关联命令: /Remove-DefaultAppAssociations - 删除 Windows 映像中的默认应用程序关联。 国际服务命令: /Set-SysUILang - 设置安装的脱机映像中使用的 无人参与服务命令: /Apply-Unattend - 将无人参与文件应用于映像。 EDGE 服务命令: /Add-Edge - 将 Microsoft Edge 添加到映像。 预配程序包服务命令: /Get-ProvisioningPackageInfo - 获取预配程序包的信息。 WINDOWS 版本服务命令: /Set-ProductKey - 设置脱机映像的产品密钥。 For more information about these servicing commands and their arguments, Examples:
C:\Users\Administrator>DISM.exe /Online /Get-Drivers /? Deployment Image Servicing and Management tool Image Version: 10.0.20348.2340
显示有关映像中驱动程序的信息。使用 /Format 选项为输出 示例: |
|
DISM.exe /Mount-Wim /? /Mount-Wim /WimFile:<path_to_WIM_file> 将 WIM 文件挂载到指定目录,以便进行维护。 示例: DISM.exe /Mount-Wim /WimFile:C:\test\images\myimage.wim /index:1 |
dism /online /Apply-Unattend /? Deployment Image Servicing and Management tool Image Version: 10.0.20348.2340
将 unattend.xml 文件应用于脱机映像或正在运行的操作系统。 示例: |
下面是DISM命令的一些常见用法:
- 检查映像状态:
dism /Online /Cleanup-Image /CheckHealth
- 扫描映像并执行修复操作:
dism /Online /Cleanup-Image /ScanHealth
dism /Online /Cleanup-Image /RestoreHealth
- 卸载未使用的驱动程序:
dism /Online /Cleanup-Image /StartComponentCleanup
- 启用或禁用Windows功能:
dism /Online /Enable-Feature /FeatureName:Feature1,Feature2,...
dism /Online /Disable-Feature /FeatureName:Feature1,Feature2,...
- 添加或删除Windows更新:
dism /Online /Add-Package /PackagePath:C:\PackageFolder\Package1.cab
dism /Online /Remove-Package /PackagePath:C:\PackageFolder\Package1.cab
- 指定映像路径:
dism /Mount-Image /ImageFile:C:\test\image.wim /Index:1 /MountDir:C:\test\offline
- 取消挂载映像:
dism /Unmount-Image /MountDir:C:\test\offline /Discard
这些都是DISM命令的一些常见用法,但别忘了在使用前要先了解和确认相应的参数和语法。
- 在映像中添加驱动程序:
dism /Image:C:\test\offline /Add-Driver /Driver:C:\test\driver\driver.inf
- 显示或更改Windows产品密钥:
dism /Online /Get-CurrentEdition
dism /Online /Get-TargetEditions
dism /Online /Set-Edition:ServerStandard /ProductKey:xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
- 导出和导入映像:
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系统的一个必要技能。
- 检查、清理和优化系统映像:
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
- 查看和设置映像信息:
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
- 禁用或启用Windows镜像更新:
dism /Online /Disable-Feature /FeatureName:MicrosoftWindowsPowerShellV2 /NoRestart
dism /Online /Enable-Feature /FeatureName:MicrosoftWindowsPowerShellV2 /All /Source:c:\test\features /LimitAccess
- 分发清单文件(只能在Windows PE中使用):
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映像文件。但每个命令都有很多参数和选项,使用前需查看相应的文档或帮助文本以了解其详细信息。
- 在映像中添加或删除语言包:
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
- 更改映像中Windows组件的状态:
dism /Online /Disable-Feature /FeatureName:IE-Optional-amd64
dism /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:D:\sources\sxs
- 恢复映像的基本文件系统和目录结构:
dism /Apply-Image /ImageFile:C:\test\image.wim /Index:1 /ApplyDir:C:\test\mounted_image /CheckIntegrity
- 安装或卸载Windows更新程序:
dism /Online /Add-Package /PackagePath:C:\test\updates\update1.msu
dism /Online /Remove-Package /PackageName:Package_for_KB123456~31bf3856ad364e35~amd64~~10.0.1.2
- 更新、替换或还原匹配的Windows组件:
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
- 设置Windows PE的引导环境:
dism /Set-Bootable-USB:ON /ISOName:"WinPE" /ImageFile:C:\test\winpe.wim /USBDrive:F:
总之,DISM命令为Windows管理员提供了许多实用的功能,包括映像维护、组件安装、语言包管理、更新程序和驱动程序安装等。但在使用之前,请务必仔细阅读相关文档和帮助信息。
- 配置和设置Windows PE的网络连接:
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
- 设置映像的默认用户配置:
dism /Online /Set-UserDefaultLocation:C:\Users\Default\AppData\Local\Microsoft\Windows\WinX\Group2
dism /Online /Set-UserLocale:fr-FR
- 检查、修复和压缩映像文件系统:
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
- 在映像中配置Windows Defender:
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
- 处理系统文件:
dism /Online /Cleanup-Image /RestoreHealth /Source:d:\sources\install.wim /LimitAccess
sfc /scannow
这些DISM命令可以帮助管理员完成各种任务,包括网络设置、用户配置、文件系统操作、安全和防病毒等。管理员可以根据需要选择适当的命令和选项来优化和管理Windows映像文件。
- 显示映像的信息:
dism /Get-WimInfo /WimFile:D:\sources\install.wim
- 配置网络驱动程序:
dism /Add-Driver /Image:C:\test\mount /Driver:C:\test\drivers\net1.inf
dism /Get-DriverInfo /Image:C:\test\mount
- 为Windows PE添加驱动程序:
dism /Add-Driver /Image:C:\test\winpe.wim /Driver:C:\test\drivers\net1.inf /ForceUnsigned
- 单独获取驱动程序信息:
dism /Get-DriverInfo /Driver:C:\test\drivers\net1.inf
- 在映像中添加或删除软件包:
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映像文件、驱动程序、安装软件包等。这些命令使用方便,但需要管理员具备一定的技术知识和经验,才能避免出错并保证系统的稳定性和安全性。
- 使用DISM设置映像的默认语言和时区:
dism /Online /Set-TimeZone:"Pacific Standard Time"
dism /Online /Set-UILang:fr-FR
- 向映像中添加或删除驱动程序:
dism /Image:C:\test\mount /Add-Driver /Driver:C:\test\drivers\net1.inf
dism /Image:C:\test\mount /Remove-Driver /Driver:oem0.inf /ForceDeletion
- 为Windows PE添加自定义组件:
dism /Add-ProvisionedAppxPackage /PackagePath:C:\test\appx1.appx /SkipLicense
dism /Add-Package /PackagePath:C:\test\lp.cab /IgnoreCheck
- 在映像中清理不需要的系统文件:
dism /Online /Cleanup-Image /StartComponentCleanup /ResetBase /AnalyzeComponentStore
- DISM还支持压缩映像文件系统以减少文件大小。这可以通过以下命令完成:
Dism /Export-Image /SourceImageFile:install.wim /SourceIndex:1 /DestinationImageFile:new_install.wim /Compress:max
以上是一些常用的DISM命令,可以帮助管理员更好地管理Windows映像、驱动程序、软件包等,增强系统的安全性和可靠性。在使用这些命令时,请务必仔细查看命令选项和文档,以避免出现问题。
- DISM还可以用于修复Windows映像文件中的损坏和错误。以下是一些常用的修复命令:
dism /Online /Cleanup-Image /CheckHealth
dism /Online /Cleanup-Image /RestoreHealth /source:WIM:F:\sources\install.wim:1 /limitaccess
- 检查和设置驱动程序自动安装策略:
dism /Online /Get-DriverFeatures
dism /Online /Set-DriverFeatures /FeatureName:"WindowsUpdate" /FeatureName:"AllowRemoteRPC"
- 使用DISM禁用或启用Windows功能:
dism /Online /Disable-Feature /FeatureName:Microsoft-Hyper-V-All
dism /Online /Enable-Feature /FeatureName:SMB1Protocol
- 使用DISM升级或降级映像系统版本:
Dism /Online /Set-Edition:Professional /ProductKey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX /AcceptEula
Dism /Online /Set-Edition:Core /ProductKey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX /AcceptEula
- DISM还可以用于管理Windows PE映像文件和虚拟磁盘文件(VHD)。以下是一些常用的命令:
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映像文件。在使用这些命令时,请务必仔细查看命令选项和文档,以避免出现问题。
- 使用DISM修复系统映像中的组件存储:
dism /Online /Cleanup-Image /StartComponentCleanup /ResetBase /AnalyzeComponentStore
- 使用DISM卸载更新程序包:
dism /Online /Remove-Package /PackageName:Package_for_KBxxxxxxx~yyyy.mm.mm~
- 使用DISM启用或禁用Windows Defender:
dism /Online /Disable-Feature /FeatureName:Windows-Defender
dism /Online /Enable-Feature /FeatureName:Windows-Defender
- 在Windows PE中添加驱动程序:
dism /Add-Driver /Image:C:\winpe\mount /Driver:C:\drivers\driver.inf
- 使用DISM禁用或启用特定功能:
dism /Online /Disable-Feature /FeatureName:IIS-WebServerRole
dism /Online /Enable-Feature /FeatureName:SMB1Protocol
- 挂载和卸载Windows映像文件:
dism /Mount-Wim /WimFile:C:\test\install.wim /Index:1 /MountDir:C:\test\mount
dism /Unmount-Wim /MountDir:C:\test\mount /Commit
- 使用DISM为Windows PE添加自定义驱动程序:
dism /Image:C:\winpe /Add-Driver /Driver:C:\drivers\driver.inf
- 使用DISM清理映像文件系统以减少文件大小:
dism /Export-Image /SourceImageFile:install.wim /SourceIndex:1 /DestinationImageFile:new_install.wim /Compress:max
以上是一些常用的DISM命令,可以帮助管理员更好地管理Windows映像、驱动程序、软件包等,增强系统的安全性和可靠性。管理员可以根据需要选择适当的命令和选项来优化和管理Windows映像文件。在使用这些命令时,请务必仔细查看命令选项和文档,以避免出现问题。