Find all Alerts in a Site Collection in SharePoint 2010

Share on facebook
Share on twitter
Share on linkedin

If you have a need to search through a SharePoint 2010 site collection and provide a report on all existing e-mail or SMS Alerts, you can use the following PowerShell script (watch for word wrapping on lines 9, 10, 11, and 12):

 1: Add-PSSnapin microsoft.sharepoint.powershell
 2:  
 3: $site = Get-SPSite "http://dlvrn2010/sites/spalerts/"
 4: $alertResultsCollection = @()
 5: foreach ($web in $site.AllWebs) {  
 6:     foreach ($alert in $web.Alerts){
 7:         $alertURL = $web.URL + "/" + $alert.ListUrl
 8:         $alertResult = New-Object PSObject

9: $alertResult | Add-Member -type NoteProperty -name “List URL”

-value $alertURL

 10:         $alertResult | Add-Member -type NoteProperty -name "Alert Title" 
       -value $alert.Title

11: $alertResult | Add-Member -type NoteProperty -name “Alert Type”

-value $alert.AlertType

 12:         $alertResult | Add-Member -type NoteProperty -name "Subscribed User"
-value $alert.User
 13:         $alertResultsCollection += $alertResult
 14:     }
 15: }
 16: $site.Dispose()
 17: $alertResultsCollection
 18:  
 19: ## Export to CSV
 20: #$alertResultsCollection | Export-CSV "Alerts.csv"

 

Using the defaults, it will output a table representation of the Alerts it found:

Host-Output_thumb.png

If you uncomment line 20, it will create a CSV file of the same data:

CSV-Output_thumb.png

You can quickly format it to a prettier, sortable report in Excel 2010 by formatting it as a table:

XSLX-Output_thumb.png

More to explore