1

I'm having difficulty with the syntax for dism /add-package on Windows Server, and what it requires as arguments in some cases. I can't find good (unambiguous) reference material for this online, I've tried.

The situation is that I'm trying to service the /online system; I managed to /remove-package an entire package so I tried to re-add it using /add-package, which should be simple, from install.wim on the DVD. But the needed arguments are not clearly explained on Microsoft's websites, for /add-package to a live system, and surprisingly I couldn't get it right. I also tried to mounted the install.wim as a folder and to /add-package from that, but again, could not find the syntax to make it work. Help would really be appreciated.

  1. DISM /get-feature needs a .WIM or a folder as a source where the feature can be found. What would count as a valid location, and especially, must a .WIM be mounted or is pointing to the install.wim (or install.wim:index) enough? If a .WIM + index can be directly referenced, what is the syntax?

  2. When adding a package using /add-package, is the package path/file itself a sufficient identifier, or must one provide a package name or other identifier as well? If so, what identifiers are valid and how are they found?

  3. If the package files are within a wim (eg the install DVD's install.wim) does one need to specify a path within that .WIM, or is specifying the .WIM (or .WIM+index) alone, enough?

  4. dism /image:X:\MOUNTEDWIM /get-packages on a mounted windows install.wim, only shows the few packages that seem to be relevant to the install; many packages that I expected to be in the source weren't listed. But trying to be more specific, using dism /image:X:\MOUNTEDWIM\Windows\servicing\Packages /get-packages, fails completely. What's wrong?

  5. What is the syntax to add an entire removed package to the live /online system, from say, install.wim:2 (from DVD or mounted folder, or either), if the package was accidentally /removed? What identifier or path, and other arguments, would I use?

Failed syntax I tried (using source DVD -> install.wim file):

  • dism /online /add-package /packagepath:"Microsoft-Windows-PACKAGE~amd64~~6.3.9600.16384" /limitaccess /source:"X:\sources\install.wim"
  • dism /online /add-package /packagename:NAME /packagepath:"X:\sources\install.wim\"
  • dism /online /enable-feature /featurename:NAME /All /Source:"X:\sources\install.wim" /LimitAccess
  • dism /online /get-features /Source:"X:\sources\install.wim" /LimitAccess
  • dism /online /add-package /packagepath:"Microsoft-Windows-PACKAGE~amd64~~6.3.9600.16384" /source:install.wim
  • dism /online /add-package /packagepath:install.wim
  • dism /online /add-package /packagepath:install.wim /ignorecheck

Failed syntax (same install.wim file, mounted as a folder):

  • dism /online /add-package /packagename:NAME /all /packagepath:X:\MOUNTEDWIM\Windows
  • dism /online /add-package /packagename:NAME /packagepath:X:\MOUNTEDWIM\Windows
  • dism /get-packages /image:X:\MOUNTEDWIM\Windows
  • dism /get-packages /packagepath:X:\MOUNTEDWIM\Windows
  • dism /image:X:\MOUNTEDWIM /get-packages

(Not one was correct!)

  • which package do you want to add again? How have you removed it? – magicandre1981 Nov 17 '14 at 4:50
  • It was during testing a few things, so it was in a VM. So I just rolled back the VM to its last snapshot. What struck me was how I couldn't work out the command to do this, so although it's not a current issue I'd like to find the answers, as I was pretty surprised I couldn't get it solved. – Stilez Nov 17 '14 at 14:14
  • Again, what do you want to add? Explain it a bit more! – magicandre1981 Nov 17 '14 at 16:53
  • I want to understand the /add-package command better. That isn't specific to any one package. It could be any package I want to add (or re-add) in future. If this happens again, I want to understand what didn't work this time. My questions above, on the use of dism /add-package, try to sum up the points that I couldn't get right or figure why they weren't working for me, and the help I'd like to ask for. – Stilez Nov 19 '14 at 10:43
  • you only have to pass the .CAB to /packagepath. That's why I ask which package you want to add again. What have you done? – magicandre1981 Nov 19 '14 at 16:53
1

The /Add-Package switch does not work in the way you're attempting to utilize it. You can view the correct syntax via:

  • DISM /Online /Add-Package /?

As others have mentioned, the DISM binary from the AIK for the online system should be utilized

  • In your case, the DISM binary from the Windows 7 AIK, not the Windows 8 or 10 ADK
    • The DISM binary in Windows 8+ is completely different from the Windows 7 binary, of which lacks the functionality of the DISM binary in Windows 8+ (ImageX was depreciated and functionality rolled into the DISM binary)

  • I created a script that will auto install the ADK (AIK in your case), then create a standalone DISM folder.
    • You'll simply need to alter the ADK version variable to 7 and download the AIK. The DISM-Creation script will do the rest.



Verify if files are correct to add a package

DISM /Online /Get-PackageInfo {/PackagePath:"<path_to_package>" | /PackageName:"<name_in_image>"}
  • /PackagePath can point to either a .cab file or a folder (not an .msu file). The path to the .cab file should point to the original source of the package, not to where the file is installed on the image.
DISM /Image:"<path_to_image>" /Get-PackageInfo {/PackagePath:"<path_to_package>" | /PackageName:"<name_in_image>"} 



Online System: Add Package

TechNet: See Limitations (bottom of link)

DISM /Image:"<path_to_image>" /Add-Package /PackagePath:"<path_to_package>" [/IgnoreCheck] [/PreventPending]
  • Where /PackagePath points to a directory, .cab, or .msu file.
    • For most packages, or at the very least ones I've added in the past, the language file must also be present for it in the appropriate language folder in the package directory (i.e. .\PackageDir\en-us).

  • Additional switches:
    • /IgnoreCheck: Skip installation of the package if the applicability checks fail
    • /PreventPending: Skip the installation of the package if the package or Windows image has pending online actions.



Offline System: Add Package

TechNet

DISM /Image:"<path_to_image>" /Add-Package /PackagePath:"<path_to_package>" [/IgnoreCheck] [/PreventPending]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.