Friday, April 24, 2015

SharePoint 2010/2013: Trim audit Logs with Powershell

In case that your storage or MSSQL filegroup is full, because  you didn't implement a proper housekeeping of your Audit logs, you can use this PowerShell command to delete them fast:


$site = Get-SPSite https://yoursite.yourdomain.com
$date = Get-Date "20/04/2015"
$site.Audit.DeleteEntries($date)

As the deletion in SQL Server LL happen on a Transaction base it might take a while. Moke sure you have enough free space on your log drive, as the log LL grow and please don't truncate table or apply any operations directly in SQL Server - SharePoint LL not be your friend anymore after such operations! ;-)




No comments:

Post a Comment