Share via


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

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.

CheckTaskSequences.zip

Comments

  • Anonymous
    January 01, 2003
    The comment has been removed

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

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    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

  • Anonymous
    January 01, 2003
    That's what item #4 above says it will do :-)

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    Will this run from WinPE?

  • Anonymous
    January 01, 2003
    Did anyone created a filter on the task sequence package ID???Thank you.

  • Anonymous
    January 01, 2003
    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

  • Anonymous
    May 06, 2011
    just wanted to say thanks a lot! this saved me a few hours worth of work!

  • Anonymous
    May 16, 2011
    Excellent post. Thank you very much!

  • Anonymous
    June 09, 2011
    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?

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

  • Anonymous
    July 29, 2013
    Hi Michael, I have used this script in the past on SCCM 2007, and it works great. Do you have any plans to create a version for SCCM 2012? I have tried the current version against our SCCM 2012 SP1 CU1 install, and while it does report on missing packages, nothing happens if the option to replicate missing packages is selected. Many thanks in advance, Paul

  • Anonymous
    March 25, 2014
    SCCM 20112 R2: "No Task Sequence selected or user selected Cancel, exiting script..."

  • Anonymous
    June 05, 2014
    Thank you so much! This will save me hours!

  • Anonymous
    July 10, 2014
    Its not checking the revision of the package. Just the pckage ID mayn't be sufficient

  • Anonymous
    December 27, 2014
    that would like you gave the light in darkness

    Thanks