Find all Alerts in a Site Collection in SharePoint 2010

May 26, 2012

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



Tags: example
Category: PowerShell
Fatal error: Call to a member function getUserUserBio() on a non-object in /mnt/HostVol01/deliveron/wwwroot/packages/problog/helpers/blogify.php on line 370 Call Stack: 0.0004 625712 1. {main}() /mnt/HostVol01/deliveron/wwwroot/index.php:0 0.0005 626168 2. require('/mnt/HostVol01/deliveron/wwwroot/concrete/dispatcher.php') /mnt/HostVol01/deliveron/wwwroot/index.php:2 0.0015 628248 3. require('/mnt/HostVol01/deliveron/wwwroot/concrete/startup/updated_core_check.php') /mnt/HostVol01/deliveron/wwwroot/concrete/dispatcher.php:20 0.0016 628968 4. require('/mnt/HostVol01/deliveron/wwwroot/updates/concrete5.6.2.1_updater/concrete/dispatcher.php') /mnt/HostVol01/deliveron/wwwroot/concrete/startup/updated_core_check.php:6 0.1508 5473520 5. Concrete5_Library_View->render() /mnt/HostVol01/deliveron/wwwroot/updates/concrete5.6.2.1_updater/concrete/dispatcher.php:264 0.8619 10858504 6. include('/mnt/HostVol01/deliveron/wwwroot/packages/problog/page_types/pb_post.php') /mnt/HostVol01/deliveron/wwwroot/updates/concrete5.6.2.1_updater/concrete/core/libraries/view.php:945 0.8688 11060576 7. Concrete5_Model_Area->display() /mnt/HostVol01/deliveron/wwwroot/packages/problog/page_types/pb_post.php:19 0.8740 11105208 8. Concrete5_Library_BlockView->render() /mnt/HostVol01/deliveron/wwwroot/updates/concrete5.6.2.1_updater/concrete/core/models/area.php:656 0.8780 11161840 9. include('/mnt/HostVol01/deliveron/wwwroot/packages/problog/blocks/content/templates/blog_post/view.php') /mnt/HostVol01/deliveron/wwwroot/updates/concrete5.6.2.1_updater/concrete/core/libraries/block_view.php:311 0.9322 12034936 10. BlogifyHelper->getBlogAuthorInfo() /mnt/HostVol01/deliveron/wwwroot/packages/problog/blocks/content/templates/blog_post/view.php:67