Clean Up Component-Based Servicing logs

Overview

Component-Based Servicing may add several gigabytes of logs to C:\Windows\Logs\CBS
https://technet.microsoft.com/en-us/library/cc756291(v=ws.10).aspx

Users may report:
CBS.logs huge
Component-Based Servicing (cbs.log) causes all drive space to be consumed

Solution

Manually delete files in C:\Windows\Logs\CBS

Run this script and/or set up this script as a scheduled task:

$limit = (Get-Date).AddDays(-15)
$path = "C:\Windows\Logs\CBS"
$files = Get-ChildItem -Path $path -Recurse -include *.log,*.cab -Exclude CBS.log,FilterList.log
$files | % {
        $_.FullName
}
$files | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item -Force -ErrorAction SilentlyContinue