SCCM Maintenance

The majority of SCCM administrators will have included a list of maintenance tasks for ensuring optimum performance of their environment. One area that often gets overlooked however is the maintenance of IIS logs.

Logs are obviously useful for troubleshooting purposes, however do you really need to know what was happening say over 30 days ago. The truth is if there was an issue you probably would have spotted it very early on and dealt with it.

So how do you deal with log files within your IIS directory filling up your disks?. The answer can be to setup a configuration item and let SCCM take care of its own compliance.

Creating Your SCCM Server Device Collection

To start with you will need to create a Device Collection to deploy the Configuration Item and subsequent Baseline to. This can be achieved by creating a device collection using the following query;

Creating Your SCCM IIS Prune Logs Configuration Item

Once you have the device collection created and populated you can go on to create the Configuration Item to be used. To speed up this process I have exported the CI CAB for you to download, below are some screen shots of the manual creation process;

Download – Prune IIS Logs

  1. Create Configuration Item

  2. Select Supported Platforms

    In this section we will pick which operating systems are applicable for SCCM distribution points

  3. Settings

    Here we will create a new setting entry that will contain both the discovery and remediation scripts required

    Discovery Script


    Remediation Script


  4. Compliance Rules

    Here we will specify when to run the remediation script you created in the previous step

Configuration Baseline

Now in order to apply the Configuration Item we will need to create a Configuration Baseline for the SCCM Server Device Collection.

  1. Create a new Configuration Baseline

  2. Set Evaluation Conditions

    Here we will add the Configuration Baseline we created earlier;

  3. Deploy the Configuration Baseline

    Set your schedule and generate an alert if required..


Now sit back, relax and watch your good work take hold across your estate;

Savings Examples

Below we have the before and after results of a distribution point running a low workload;

Before (Manual Run)

After (Manual Run)

When you have a large environment with thousands of clients you can clearly see the storage recovery benefits!.

Manual Script

If you want to run the script manually or deploy as a scheduled task, you can use the below PowerShell script (Download from;



A special thanks goes out to Johan Arwidmark for sharing this clean up script on his DeploymentResearch blog (


There are no comments.

Leave a Reply