Wednesday, May 25, 2011

Determine auditing configuration details for all of your SharePoint site collections

I recently had a customer whose SharePoint audit tables had getting very large. They wanted to know which site collections had auditing enabled so they could meet with their end users to determine if auditing was really necessary. Here is a code snippet for finding out which SharePoint sites have auditing enabled. The code will loop through all site collections in the farm and then create a CSV file with auditing configuration details.
InstructionsCreate a c# Console Application in Visual Studio, add a reference to Microsoft.SharePoint, and then add the following code to Program.cs. This will work with SharePoint 2007 and 2010 as long as you reference the correct assembly. Don’t forget to make sure your Visual Studio project’s Platform Target is Any CPU or x64.