Close Menu
    Facebook X (Twitter) Instagram
    Sunday, October 12
    X (Twitter) LinkedIn Reddit RSS
    All about Endpoint Management
    • Home
    All about Endpoint Management
    Home»SCCM 2007»#SCCM / #Configmgr Package Archival Process / Cleanup Activity

    #SCCM / #Configmgr Package Archival Process / Cleanup Activity

    Eswar KonetiBy Eswar KonetiNovember 30, 6:23 am2 Mins Read SCCM 2007 3,436 Views
    Share
    Facebook Twitter LinkedIn Reddit

     

    Clean

    SCCM Package Clean Up activity? When you Build SCCM in your Environment, you create lot of packages to deploy onto clients But later sometime, you get updated versions for it   or no more in use.

    Packages which are not in use resides in Database and occupies disk space on the source server as well on the Distribution Points.

    As SCCM admin guy, you should look at package clean up activity once in year or so depends on the requirement.

    For Packages which has no advertisements, look here http://eskonr.com/2012/10/sccm-report-software-distribution-packages-with-no-advertisements/

    Use this report to list packages which are not used recently for 1 year based and it is filtered with its advertisement status. This will not get the packages which are used in Task Sequences.

    If you have any packages which are not used for 1 year but still if they are part of Task Sequence, you won’t see the results.

     

    SELECT   
          A.AdvertisementName AS [Advertisement Name],
          A.PresentTime AS Created,
          MAX(CAS.LastStatusTime) AS [Last Time Used],
          p.packageID,
          A.ProgramName,
          A.CollectionID,
          P.PkgSourcePath,
                (SELECT COUNT(PkgID) FROM vPkgStatusSummaryDistPts WHERE PkgID = p.PackageID) AS [No of DP]
    FROM
          v_Package P
          INNER JOIN v_Advertisement A ON P.PackageID = A.PackageID
          INNER JOIN v_ClientAdvertisementStatus CAS ON A.AdvertisementID = CAS.AdvertisementID
    WHERE
          (CAS.LastStateName != 'Accepted - No Further Status')AND
          p.PackageID NOT IN (SELECT ReferencePackageID FROM v_TaskSequenceReferencesInfo) and p.Packagetype=0

    GROUP BY
          A.AdvertisementName,
          A.PresentTime,
          A.CollectionID,
          P.PkgSourcePath,
          P.Name,
          P.PackageID,
          A.ProgramName,
        P.Description
    HAVING
          (MAX(CAS.LastStatusTime) IS NOT NULL)
          AND datediff(mm,MAX(CAS.LastStatusTime),getdate()-365) > 0

    ORDER BY
          A.AdvertisementName,
          A.PresentTime

    Good Luck!

    Advertisement report Clean up sccm packages packages not used SCCM 2007 SCCM Package Archival Process sccm report SCCM report Clean up Activity for Packages Task sequece packages
    Share. Twitter LinkedIn Email Facebook Reddit

    Related Posts

    SCCM SQL Report – Compare Installed Apps on TWO Different Computers

    July 13, 10:35 am

    Monitoring Endpoint Security Applications with SCCM ConfigMgr SQL

    October 11, 8:48 pm

    SCCM report list collections with no deployments

    December 05, 12:04 pm

    4 Comments

    1. Fredrik on May 7, 2013 3:54 PM

      Thanks for your reply, but neither me or a college (who knows more SQL, but not SCCM) was sure what you were referring to when you say they I have to adjust the double quotes, i.e. " symbol? To what part of the code are you referring to?

      Reply
      • Eswar Koneti on May 8, 2013 7:35 AM

        Hi Fredrik,
        there is only one single quote you need to replace at Accepted – No Further Status.I just tried and it worked perfect.

        Reply
    2. Fredrik on May 6, 2013 5:17 PM

      Likks like what I need but I get som error:

      ---
      [[42000][102][Microsoft][ODBC SQL Server Driver][SQL Server]Oncorect syntax ner ". -- [42000][156][Microsoft][ODBC SQL Server Driver][SQL Server] Incorrect syntax ner the word 'and'.
      ----

      I would like to se packages not being used eaven if thay are usd in a Task Sequences

      Reply
      • Eswar Koneti on May 7, 2013 9:33 AM

        you will have adjust the double quotes. replace them and run the query.
        if you would like to have all packages from the Task sequence,remove the below lines.

        AND
        p.PackageID NOT IN (SELECT ReferencePackageID FROM v_TaskSequenceReferencesInfo)

        Reply

    Leave a ReplyCancel reply

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

    Sign Up

    Get email notifications for new posts.

    Author

    I’m Eswar Koneti ,a tech enthusiast, security advocate, and your guide to Microsoft Intune and Modern Device Management. My goal? To turn complex tech into actionable insights for a streamlined management experience. Let’s navigate this journey together!

    Support

    Awards

    Archives

    © Copyright 2009-2025 Eswar Koneti, All rights reserved.

    Type above and press Enter to search. Press Esc to cancel.