DISM is the Swiss Army Knife of Windows 10 maintenance and with the Windows 10 Creators Update it gained a helpful collection of PowerShell scripts. Here's how to put them to use.
By Ed Tittel
With the release of the Windows 10 Creators Update in early April, Microsoft changed the default command-line environment in Windows 10 from the Command Prompt (aka cmd.exe) to PowerShell. There, the old black-and-white command-line interface gives way to a new, blue-and-white style in the latest version of Windows 10.
But the powerful Deployment Image Servicing and Management (DISM) command that I’ve described as the Swiss Army Knife of Windows 10 maintenance got more than a new color; it gained a collection of PowerShell scripts — called “cmdlets” (pronounced “command-lets”) in PowerShell-speak – that go a long way toward simplifying its syntax and usage.
Where to look for DISM-related cmdlets
As it happens, there’s a peachy guide to the whole panoply of DISM commands as they map into equivalent PowerShell cmdlets. It’s online at the MSDN Hardware Dev Center, and it’s called “Use DISM in Windows PowerShell.” There are multiple versions of this document around, so grab one that’s been updated on or after January 3, 2017 to be sure you get the most current version for Windows 10 and Windows Server 2016.
Basically, this document consists of a table with 45 entries, each of which corresponds to a particular variant of the DISM command. What you won’t find there are the syntax details, so it’s best to turn to the online “get-help” cmdlet via PowerShell. Not only is this handy and convenient, but PowerShell will also download the most current help files for all cmdlets with your permission each time you use it. This takes a while (a couple of minutes on my test Lenovo X220 Tablet PC), but it’s worth the wait. Here’s an example of the output for the get-help cmdlet illustrated in Figure 1.
When you look at get-help output in PowerShell, the text doesn’t wrap nicely as shown above. (I captured the output, took it into Notepad, wrapped the text at 80 columns, then used the “type” command in PowerShell to produce the text in Figure 2.) Instead, it spreads out across more than a full HD display. But you can find lots of great information there, including syntax details (shown), explanations of key parameters (shown), plus links to related commands and information about how to use get-help to produce further information.
This is quite valuable to see (and know), so here is that information for the Repair-WindowsImage command along with examples:
The following table includes all the DISM commands I’ve discussed, with their PowerShell cmdlet equivalents. You can use get-help with those cmdlet names yourself to learn how to use PowerShell with DISM. When you do, you’ll notice that the cmdlets are generally easier to use and understand than the corresponding DISM command syntax. And, of course, that’s why I recommend that you do so the next time you need to use DISM for any of its many capabilities, from obtaining image information to repairing images or adding or removing drivers, packages and features from images, and so on.
In working with these cmdlets, those familiar with DISM will find it expeditious to use the PowerShell help command “get-help -examples” to see related syntax, including important switches and parameters. That’s how I worked my way through the items that appear in the preceding table myself. I assume that if this approach worked for me, it will work for others as well. Enjoy!