Close Menu
    Facebook X (Twitter) Instagram
    Tuesday, May 20
    X (Twitter) LinkedIn
    All about Endpoint Management
    • Home
    All about Endpoint Management
    Home»CM2012»SCCM Configmgr Clean Old Client logs that contain SCNotify and SCClient using Compliance Settings

    SCCM Configmgr Clean Old Client logs that contain SCNotify and SCClient using Compliance Settings

    Eswar KonetiBy Eswar KonetiAugust 08, 6:48 pm3 Mins Read CM2012 5,843 Views
    Share
    Facebook Twitter LinkedIn Reddit

    Few months ago ,i wrote blog post about how to use Compliance Settings to clean content in ccmcache folder. For more information, please refer http://eskonr.com/2016/08/sccm-configmgr-how-to-clean-ccmcache-content-older-than-x-days-using-compliance-settings/

    This blog post is about deletion of client log files that contain SCNotify and SCClient.

    What does these logs capture information about ?

    SCNotify_<domain>@<username>_1.log : Records the activity for notifying users about software for the specified user.

    SCNotify_<domain>@<username>_1-<date_time>.log: Records the historical information for notifying users about software for the specified user.

    SCClient_<domain>@<username>_1.log: Records the activity in Software Center for the specified user on the client computer.

    SCClient_<domain>@<username>_2.log: Records the historical activity in Software Center for the specified user on the client computer.

    From these  logs ,you will see lot of wmi classes and information about application notification to user with their availability and also use activities performed against the software center.

    We will use compliance settings to detect if there are any files with these logs that are older than 7 days and if the count is more than 0 then perform the cleanup.

    I am not going in detail step by step to show you how to create compliance settings ,instead i will provide the discovery script and remediate script along with CAB files that i exported from my lab.

    So If you want to create your own from scratch ,just replace the script form below for discovery and remediation and you are good OR

    you can import the CAB file into your Configmgr and make changes how you like for example ,changing the number of days from 7 to 15 or what ever you like and logs folder location (C:\windows\ccm\logs).

    Import the CAB file, deploy the configuration baseline to your clients on schedule basis.

    Download the Configuration Baseline file from Technet Gallary

    Discovery Script:

    #discover
    $MinDays = 7
    (Get-ChildItem C:\windows\ccm\logs | Where-Object { ($_.Name -like 'SCNotify*' -or $_.Name -like 'SCClient*' -or $_.Name -like '_SCNotify*' -or $_.Name -like '_SCClient*') -and ([datetime]$_.LastWriteTime -lt (get-date).adddays(-$MinDays))} |Measure-Object).count

    Remediation Script:

    #Remediate
    $MinDays = 7
    $logs=Get-ChildItem C:\windows\ccm\logs | Where-Object { ($_.Name -like 'SCNotify*' -or $_.Name -like 'SCClient*' -or $_.Name -like '_SCNotify*' -or $_.Name -like '_SCClient*') -and ([datetime]$_.LastWriteTime -lt (get-date).adddays(-$MinDays))}
    ForEach ($log in $Logs)
    {
    del $log.FullName
    }

    Here is the client that i noticed ,it has 1436 logs out of which with size of 530MB ,of which ,450MB+ logs are with SCNotify and SCClient that are older than 7 days.

    image

    Before i run the script ,there are 1436 files with size about 550MB.

    After the script:

    image

    After the script ,file count reduced to 189 with size 20MB.

    Hope this helps !

    client logs Compliance settings configmgr configuration baseline delete client old logs Delete Scnotify Powershell SCClient SCCM SCNotify_@_1.log
    Share. Twitter LinkedIn Email Facebook Reddit

    Related Posts

    Optimize Your Intune Workflow with a Powerful Browser Extension

    March 22, 10:39 am

    Migrate Microsoft 365 Updates from SCCM/MECM to Intune for Co-Managed Devices

    February 11, 9:50 pm

    Investigating Co-Management Issues with Windows Endpoints in SCCM/Intune

    October 26, 10:45 pm

    3 Comments

    1. Dominique on June 28, 2019 11:57 PM

      Great post again!! Thanks.
      I wonder if there is a report showing the file numbers and Space used which could be run before and after to show the management the efficiency of this.

      Reply
      • Eswar Koneti on July 4, 2019 3:59 PM

        Hi Dom,
        There is no builtin way to show files in the folder unless the script log the count of files and then pipe that information into registry and extend hardware inventory but it is all not required .
        What you can do is ,you can enable the ccmcache inventory to know the size of the folder and monitor it daily basis with reporting. Now there is built in way to extend the ccmcache and also delete the content automatically if size is become less.

        Thanks,
        Eswar

        Reply
    2. Ram on August 9, 2017 10:32 PM

      Awesome !!

      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-2024 Eswar Koneti, All rights reserved.

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