What are the DISM cmdlets?

Learn how to use the DISM cmdlets

John Savill

February 23, 2017

1 Min Read
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 moduleGet-Command -Module dism#View the edition of the current OS (must run elevated)Get-WindowsEdition -Online#Get information about all images in a WIM fileGet-WindowsImage -ImagePath "S:OS ImagesWindows Server 2016 RTMExpandedsourcesinstall.wim"#Get information about a specific indexGet-WindowsImage -ImagePath "S:OS ImagesWindows Server 2016 RTMExpandedsourcesinstall.wim" -Index 3#Create a folder that will be used to mount imagesNew-Item c:wimmount -ItemType Directory#Mount a WIM file, index 3 to folder c:wimmountMount-WindowsImage –ImagePath "S:OS ImagesWindows Server 2016 RTMExpandedsourcesinstall.wim" -Index 3 –Path "c:wimmount"#View the content of the mounted WIMGet-ChildItem C:wimmount#View all mounted imagesGet-WindowsImage -Mounted #dism /get-mountedwiminfo#Check the health of a mounted imageRepair-WindowsImage –Path "c:wimmount" -ScanHealth#Add an extracted CAB file from MSU to a mounted imageAdd-WindowsPackage –Path "c:wimmount" –PackagePath "S:OS ImagesWindows Server 2016 RTMUpdatesWindows10.0-KB4010672-x64.cab" -PreventPending#Add drivers from a folder to a mounted imageAdd-WindowsDriver -Path C:wimmount –Driver "c:drivers" –Recurse#Dismount a mounted image without saving changes. Could also use -Save instead of -Discard to saveDismount-WindowsImage –Path "c:wimmount" -Discard#View information about a VHDGet-WindowsImage -ImagePath "D:VMsWin10ProVirtual Hard DisksWin10Pro.vhdx"#Mount a VHDMount-WindowsImage -ImagePath "D:VMsWin10ProVirtual Hard DisksWin10Pro.vhdx" -Index 1 -Path c:wimmount#View information about the mounted VHDGet-WindowsEdition -Path C:wimmount#DismountDismount-WindowsImage –Path "c:wimmount" -Discard

 

About the Author(s)

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like