Skip navigation
What are the DISM cmdlets?

What are the DISM cmdlets?

Q. What are the DISM cmdlets?

A. DISM is a very powerful tool for image management and there are PowerShell cmdlets that have equivalent functionality in the DISM PowerShell module.

Below are some PowerShell commands that walk through some of the common functionality to expose some of the core capabilities that I have put together.

#View all cmdlets in the DISM module
Get-Command -Module dism

#View the edition of the current OS (must run elevated)
Get-WindowsEdition -Online

#Get information about all images in a WIM file
Get-WindowsImage -ImagePath "S:\OS Images\Windows Server 2016 RTM\Expanded\sources\install.wim"

#Get information about a specific index
Get-WindowsImage -ImagePath "S:\OS Images\Windows Server 2016 RTM\Expanded\sources\install.wim" -Index 3

#Create a folder that will be used to mount images
New-Item c:\wimmount -ItemType Directory

#Mount a WIM file, index 3 to folder c:\wimmount
Mount-WindowsImage –ImagePath "S:\OS Images\Windows Server 2016 RTM\Expanded\sources\install.wim" -Index 3 –Path "c:\wimmount"

#View the content of the mounted WIM
Get-ChildItem C:\wimmount

#View all mounted images
Get-WindowsImage -Mounted #dism /get-mountedwiminfo

#Check the health of a mounted image
Repair-WindowsImage –Path "c:\wimmount" -ScanHealth

#Add an extracted CAB file from MSU to a mounted image
Add-WindowsPackage –Path "c:\wimmount" –PackagePath "S:\OS Images\Windows Server 2016 RTM\Updates\Windows10.0-KB4010672-x64.cab" -PreventPending

#Add drivers from a folder to a mounted image
Add-WindowsDriver -Path C:\wimmount –Driver "c:\drivers" –Recurse

#Dismount a mounted image without saving changes. Could also use -Save instead of -Discard to save
Dismount-WindowsImage –Path "c:\wimmount" -Discard

#View information about a VHD
Get-WindowsImage -ImagePath "D:\VMs\Win10Pro\Virtual Hard Disks\Win10Pro.vhdx"

#Mount a VHD
Mount-WindowsImage -ImagePath "D:\VMs\Win10Pro\Virtual Hard Disks\Win10Pro.vhdx" -Index 1 -Path c:\wimmount

#View information about the mounted VHD
Get-WindowsEdition -Path C:\wimmount

#Dismount
Dismount-WindowsImage –Path "c:\wimmount" -Discard

 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish