My Profile Photo

luke.geek.nz


An IT Engineer with a love for all things IT including (but not limited to), Microsoft Azure, Automation and Service Management!


A couple of useful DISM commands for WIM management for the IT Pro

As part of being an IT Engineer at my place of employment – I work with operating system deployment and management – part of this is using the Windows DISM toolset for adding packages or drivers directly into a Windows OS WIM or boot WIM.

Here are a few useful DISM commands I have gathered and use on a monthly basis with WIM management and updates.

Using DISM to mount a WIM

When using DISM to mount a WIM – it mounts the WIM to a folder – similar to creating a virtual drive. So before you open up that Command Prompt – create a temporary mount directory first – for example c:\temp\mnt

_as I am using in my example.

_

  1. Open an elevated Command Prompt
  2. Type in: dism.exe /Mount-WIM /WimFile:”C:\Temp_OS.wim_” /index:1 /MountDir:”C:\Temp\mnt” (Replace – OS.wim with the name of your WIM image)
  3. Your WIM should now successfully mounted in c:\temp\mnt

Using DISM to un-mount a WIM

Once you have finished modifying your WIM. You will need to unmount it, when unmounting the WIM with DISM you have 2 options, to unmount and discard any changes or to unmount and commit any changes you have made into the WIM.

To commit your changes:

  1. Open an elevated Command Prompt
  2. Type in: dism.exe /Unmount-Image /MountDir:”C:\temp\mnt” /commit

To discard your changes:

  1. Open an elevated Command Prompt
  2. Type in: dism.exe /Unmount-Image /MountDir:”C:\temp\mnt” /discard

Using DISM to add drivers recursively to a WIM

Adding drivers into a WIM – either a boot image or OS WIM can be painful – however using DISM I can easily recursively add drivers that are in folders – even several levels deeper recursively and automatic. This allows me to add a full set or set of Windows drivers into a WIM.

  1. Open an elevated Command Prompt
  2. Type in: dism.exe /image:”c:\temp\mnt” /Add-Driver /Driver:”C:\temp\driversfolder” /Recurse

Using DISM to add packages to a WIM

Adding Windows packages (MSU/CAB files) into a boot or OS WIM is easy with DISM. I used this method to add the IE11 MSU into the Windows 7 x64 WIM – as is the example I am using here:

  1. Open an elevated Command Prompt
  2. Type in: dism.exe /image:”C:\temp\mnt” /Add-Package /PackagePath:”C:\temp\IE11″

Using DISM to remove superseded Windows Updates and unused system files from Windows online for Windows 8 and Windows Server 2012

One of the useful features of Windows – is a feature called Disk Cleanup – this utility allows you to remove superseded Windows Updates and Windows update installer and system file remnants. Windows servers usually do not have this installed – you can do this using DISM.

  1. Open an elevated Command Prompt
  2. Type in: dism.exe /Online /Cleanup-Image /StartComponentCleanup

Using DISM to remove superseded Windows Updates and unused system files from a Windows WIM offline

Removing superseded Windows Updates and unused/invalid system files from a WIM helps reducing the OS deployment time by cleaning up the file size of the WIM and helps create a clean OS environment for new machines.

  1. Open an elevated Command Prompt
  2. Type in: dism.exe /Image: “C:\temp\mnt” /Cleanup-Image /StartComponentCleanup

Using DISM to install .NET Framework 3.5 on Windows Server 2012/2012 R2

Some applications require .NET 3.5 which is not installed on Windows Server 2012 by default. You can install this feature using DISM and the Windows server DVD/ISO online. Please note that “D:” is the CD/DVD drive letter in this example and may need to be changed if this does not match your environment.

  1. Open an elevated Command Prompt
  2. Type in: dism.exe /online /enable-feature /featurename:NetFX3 /all /Source:d:\sources\sxs /LimitAccess

Managing DISM from a GUI frontend

Thankfully – for all those fans of point and click (even I prefer to use this on occasion) – a few people have written a GUI frontend for DISM. Allowing you to do all the things mentioned above from a point and click interface.

  1. The file can be downloaded from: https://dismgui.codeplex.com/ and is free of charge. This is a standalone application that doesn’t require an install and has a small footprint (current file size as of this article is 122KB).

More DISM resources

  1. https://technet.microsoft.com/en-us/library/hh825099
  2. https://msdn.microsoft.com/en-us/library/jj980032
comments powered by Disqus