DISM.exe Return Codes?

Tyler picture Tyler · Jul 28, 2016 · Viewed 7.3k times · Source

I have a program that calls the dism.exe program and it runs a few commands in the background. Right now, I only check for a return code of 0 or anything else in order to show a process failed or succeeded. What could i cross examine the return code with in order to get an accurate return error. Which returns are the DISM referenced to?

Answer

Martin Ba picture Martin Ba · Apr 5, 2019

The link provided in the comment DISMAPI Error Messages provides a very few error code, but in my experience, these are not the most common error codes returned by DISM.exe.

In my scenarios, I mostly use dism.exe /Online ... and here's what I found so far:

  • ERROR_SUCCESS_REBOOT_REQUIRED ~ 3010 (0xBC2) when /Add-Package requires a reboot.
  • ERROR_BAD_FORMAT ~ 11 (0xB) when you hand /Add-Package a package that is not applicable to this operating system (e.g. an x86 package for a x64 Windows)
  • ERROR_PATH_NOT_FOUND ~ 3 when the file you hand to /PackagePath doesn't exist
  • ERROR_ELEVATION_REQUIRED ~ 740 (0x2E4) when you're not running as admin.

Additional Links: