Wednesday 2 October 2013

Remove alerts from all SharePoint Sites

Want to Remove alerts from all SharePoint web applications including each site collections and sub-sites?




*Do not run on Production Environment. Its should run on development and Testing Environment only.


Run below Powershell script:

foreach ($site in Get-SPSite -Limit All) 
{ 
  "Site Collection $site" 
  foreach ($web in $site.allwebs)
  {
     "  Web $web"
     $c = $web.alerts.count
     "    Deleting $c alerts"
     for ($i=$c-1;$i -ge 0; $i--) { $web.alerts.delete($i) }
  }
}

No comments:

Post a Comment