SharePoint2010 – Handling Alerts with Powershell

Alerts are a SharePoint functionality almost all of my clients use, to get an overview off all alerts of a specific sitecollection (for each user) your good friend PowerShell is an enormous help.


Get All Alerts from a sitecollection:

Get-SPweb -site http://yoursite -limit all | ForEach-Object {$_.alerts|foreach-object{write-host $_.user $["siteUrl"] $["dispformurl"]}}


If you do a migration of urls you want the url within your alerts to be changed as well of course, you can do this by using the following script for one or all sitecollection within your webapplication.


Update Alerts of one SiteCollection:

Get-SPweb -site http://yoursite -limit all |ForEach-Object {$_.alerts|foreach-object{$["siteUrl"] = "http://yoursite";$_.update()}}


Update Alerts for all SiteCollections:

get-spsite -limit all -WebApplication http://yoursite | get-spweb -limit all |ForEach-Object {$_.alerts|foreach-object{$["siteUrl"] = "http://yoursite";$_.update()}}


Please be aware that you run any scripts on your own risk, as always you should know what you are doing, don’t call me up crying and tell me you ran that script you weren’t sure about what it actually does and it burned down your environment.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: