Clean SCCM Primary Site IIS Logs

Clean SCCM Primary Site IIS Logs

$logs = Get-ChildItem -Path C:\inetpub\logs -Recurse -Filter *.log
$oldest = (get-date).AddDays(-30)
foreach($log in $logs){
    if($log.LastWriteTime -lt $oldest){
        $log.Delete()
     } 
}

 

Use this script to cleanup all sccm primary site IIS logs which takes lots of space and each files are huge in size.

 

 

Exit mobile version