Over time Software Update Packages (read Deployment Packages, but with a proper name) most of the time are filled with unwanted Software Updates if no regular maintenance is performed, leading to unwanted Software Update content taking up unnecessary disk space. I’ve previously created a script to remove expired and superseded Software Updates from a Software Update Group that also removes the content. For most cases using this script or console extension is sufficient. But in some cases, you might have to attack the problem from another angle. In this post I’ll share a script that I’ve created for a good friend of mine that will clean up a Software Update Package from Software Updates that meets the criteria passed to the script.

Download the script

You can download the script from the following link:


Script documentation

Version 1.0.0 of the script contains requested features such as capabilities to be able to remove Software Updates that are either not deployed or was not required by any systems according to scan data. Since ConfigMgr environments never look the same, and different scenarios present themselves, the two main features of the script can selectively be chosen when the script is invoked, catering for different usage scenarios:

  • Remove Software Updates that are not deployed
  • Remove Software Updates that are not required on any systems

In future version, I’ll add additional capabilities, and if wanted from the community it could be turned into a console extension.


Use the script to clean a Software Update Package that contains Software Updates matching any or all of the criteria mentioned above. Below is an example of a Software Update Package that contains a set of Software Updates that match both criteria:

Follow the instructions below to run the script:

Before you can run the script, you’d need to identify the PackageID value of the Software Update Package you want to clean up. Use the value of the package and pass it to the -PackageID parameter.

  • Download the script from GitHub and place it on e.g. C:\Scripts.
  • Open an elevated PowerShell console and browse to where you saved the script.
  • Run the following command (remember to change the parameter values to suite your environment):
.\Clean-CMDeploymentPackage.ps1 -SiteServer CM01 -PackageID P0100067 -NonDeployedUpdates -NonRequiredUpdates -ShowProgress -Verbose

By using the -ShowProgress and -Verbose switches with the script, you’ll get an overview of the current progress together with detailed information regarding what the script is actually doing.

When the script has executed successfully and completed, the Software Update Package will no longer contain the Software Updates that got removed:


  • Fredrik
    Posted at 17:41 August 17, 2017

    Working very nice, saved alot of space after running this. Thanks

  • Santhosh Basavarajappa Shakuntala
    Posted at 13:43 August 18, 2017
    Santhosh Basavarajappa Shakuntala

    is there a script which i can use for WSUS. its killing my hard drive space.

  • Heiko
    Posted at 09:33 February 7, 2018

    Works the script in SCCM 1710 as well?

  • Michael
    Posted at 06:53 October 3, 2018

    Hi Nikolaj, I was wondering if you had any trick to disable/hide/delete all those updates prior to 1803 in the ‘All Software Updates’ like w10 1507,1511,1607,1703,1709. It becomes a little bit to crowded šŸ™‚

  • Pascal
    Posted at 09:37 October 12, 2018

    This Script works just Great! (v1802). Just what i needed! Thank you so much!!

  • John
    Posted at 21:40 October 23, 2018

    This is simply fantastic. I was able to reduce my update packages by many GBs with this and it worked flawlessly. Thank you so much for your contributions to this community!

    Run using ConfigMgr CB 1806 for others wondering.

  • Adam
    Posted at 22:17 December 6, 2018

    Are there plans to put in whatif capability?

    • Nickolaj Andersen
      Posted at 00:10 December 8, 2018
      Nickolaj Andersen

      Hi Adam,

      If I’m not mistaken that should be in the newly released 1.0.1 version of the script.


      • Adam
        Posted at 12:52 December 10, 2018

        Yes, you’re right! Thanks!

  • Andrew
    Posted at 22:09 December 10, 2018

    This is great. Can’t believe they didn’t provide a more direct/easy way of doing this. Thanks Nickolaj!

  • Leave a Reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.