Updated Clean Software Update Groups script for ConfigMgr

Ever since I released the console extension for ConfigMgr to clean up Software Update Groups from expired and/or superseded Software Updates, many have given me lots of feedback and I’m now pleased to announce that I’ve updated the script with a new version. In this new version of the Clean-CMSoftwareUpdateGroups.ps1 script, the total execution time hav been improved enormously. Previously it could take minutes to complete the clean up process, but with the new version it only takes a couple of seconds (at least in my demo environment and at some customers where I’ve tested this). I’ve also added two new options for you to choose how to perform the clean up process, you can read more about that below.

With this updated script, you now have the option to clean your Software Update Groups by the following criteria:

  • Expired and Superseded (Remove content)
  • Expired and Superseded (Keep content)
  • Expired Only (Remove content)
  • Expired Only (Keep content)
  • Superseded Only (Remove content)
  • Superseded Only (Keep content)

Download the console extension

You can download the console extension from the TechNet Gallery.


Refer to the installation documentation on the following blog post:


Let me know if you have any questions or suggestions.


  1. Sandy

    Does it work on ConfigMgr v1511? 🙂

    1. NickolajNickolaj (Post author)

      Hi Sandy,

      It sure does. I’ve tested it on the following versions:

      – ConfigMgr 2012 R2
      – ConfigMgr 2012 R2 SP1
      – ConfigMgr 1511


  2. Pingback: » Updated Clean Software Update Groups script for ConfigMgrKlient.nu

  3. Pingback: » Updated Clean Software Update Groups script for ConfigMgr | System Center ConfigMgrKlient.nu

  4. Tim

    Thanks for updating this script. It works GREAT!

    1. NickolajNickolaj (Post author)

      Hi Tim,

      You’re very welcome!


  5. Baard

    Just ran your script, but it did not seem to remove content from the different SUPs when i ran Expired only nor Superseded only, (both the Remove content version).

    It was only when i ran Expired and Superseded (remove content) that the content actually disappeared.
    Since there are no log files to peruse, i just caught a glimpse on the verbose that there was nothing to remove in the to first, whereas i could see some verbosity about removing content when running Expired and Superseded.

    Any tips or thoughts?

    1. NickolajNickolaj (Post author)

      Hi Baard,

      It’s by design, because a Software Update can be in the following states:

      – Expired and Superseded
      IsExpired = True
      IsSuperseded = True

      – Expired Only
      IsExpired = True
      IsSuperseded = False

      – Superseded Only
      IsExpired = False
      IsSuperseded = True

      So for instance in an environment where you’re not delaying supersedence and expire information, a Software Update would be expired and superseded at the same time. Therefor when running the Expired Only option for instance, it will check if Software Update instance is _ONLY_ expired 🙂


      1. Baard

        Ah, ok, all is well then, thanks 🙂

  6. Sonny

    Hi Nickolaj,

    Many Thanks for this Great Job !
    Can we use this script with command line not with console extension and only for one Software Update Group ?
    And can we use correctly the “remove content” with a DFS share folders ?
    It was not always correct with previous script (version of November 18, 2014)

  7. Li Xiang

    Thank you very much for post this solution !
    My question is if to use (Remove Content) option, it will remove the downloaded update files from the software update packages? and also do a refresh of the packages?
    Just want to avoid to refresh many packages at same time.
    Thank you.

  8. James


  9. shashidhar

    Hi ,

    i want to stop/disable windows services, how can i do that by using SCCM?

  10. Pingback: Updated Clean Software Update Groups script for ConfigMgr | MS Tech BLOG

Leave a Comment

Your email address will not be published. Required fields are marked *