Make sure a ConfigMgr task sequence has all the packages it needs

Make sure a ConfigMgr task sequence has all the packages it needs

Rate This
  • Comments 9

If you’ve done ConfigMgr OS deployments, you’ve probably seen an error dialog like this before:

image

Pretty simple, right?  Distribute this package to a local DP and then try again.  But there are often dozens (or in extreme cases, hundreds) of packages referenced by the package, so you might have to go through this cycle a few times before you get them all.  Fortunately, there are some ConfigMgr WMI classes that can help figure out which packages are missing.  With a little bit of PowerShell logic, we can automate the whole process, through these basic steps:

  1. Get a list of all the task sequences.
  2. Get a list of all the packages referenced by those task sequences.
  3. Compare the complete list of distribution points against the list for each referenced package.
  4. Add a new distribution point to each package that is missing (keeping in mind that only boot images need to be distributed to SMSPXEImages$ distribution point shares).

This process will take care of boot images, OS images, OS install packages, driver packages, software update packages, or any other type of packages that are referenced (because behind the scenes, packages are packages to ConfigMgr – only the UI differentiates).

The scripts needed to this are attached to this blog.  You’ll need to save the SCCM.psm1 file in an appropriate PowerShell module folder (see the comments in the script for more details) so that the CheckTaskSequences.ps1 script can find it (and of course you’ll have to enable PowerShell script execution using something like “Set-ExecutionPolicy RemoteSigned”).  Then, just run CheckTaskSequences.ps1 each time you create a new task sequence.  It will very quickly identify the packages that need to be distributed and take care of those for you.

Note:  Version 1.1 of the script is now attached (using version 1.5 of SCCM.psm1) to address a couple of bugs found in the current version.  See the comments in CheckTaskSequences.ps1 for more information.

Attachment: CheckTaskSequences.zip
Leave a Comment
  • Please add 3 and 1 and type the answer here:
  • Post
  • just wanted to say thanks a lot! this saved me a few hours worth of work!

  • Excellent post. Thank you very much!

  • Does this also check for applications installed using the package variable in the TS? And is there a way to just list all of the packages referenced?

  • It will check all packages explicitly referenced by the task sequence - those installed using the PACKAGESxxx variables aren't explicitly referenced by the task sequence, so those won't be found or distributed.

    -Michael

  • Will this run from WinPE?

  • While it probably could run from Windows PE (making a WMI connection to a remote ConfigMgr server, with credentials), I don't see any real advantage to doing it that way - run it from the site server, preferably well in advance of your deployments.

    -Michael

  • omg I didn't realise this does more than report on missing packages... I have packages being copied all of the globe now >_<

  • That's what item #4 above says it will do :-)

  • @lord_hydrax Wow, how do you just run a script without understanding what it does?

Page 1 of 1 (9 items)