Reporting on SharePoint Event Receivers

SharePoint Event Receiver Reporting

Event Receivers are a very powerful SharePoint construct. Because of timing issues, they can be tricky to get right. My good friend Jimil Ibrahim asked about this recently, prompting me to provide just such a reporting capability for general use. Below is a script that will quickly generate a report of all Event Receivers in all Libraries, in all SPWebs in all SPSites. The output is easily imported into MS-Excel for rapid analysis.

$wa=Get-SPWebApplication http ://SharePoint  #susbstitute with your own Web Application.
foreach ($site in $wa.Sites)
{
Write-Host "S" -NoNewline
foreach ($web in $site.allwebs)
{
Write-Host "W" -NoNewline
for ($LibIndex=0; $LibIndex -lt $web.Lists.Count; $LibIndex++)
{
Write-Host "L" -NoNewline
$list = $Web.Lists[$LibIndex];
$i=0;
foreach ($ER in $list.EventReceivers)
{
Add-Content C:ReportsERs.csv "$($Site.url),$($web.title),$($web.url),$($List.title), Event $($i): $($ER.name), $($ER.Synchronization)"
$i++
}
}
}
}
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *