Removing User Alerts from a Web Application in SharePoint 2010 Using Windows PowerShell

Video length: 2:05

Video description: This video walks through the process of removing a specific user alerts from a web application in SharePoint 2010 using Windows PowerShell

To remove alerts for a specific user, launch SharePoint 2010 Management Shell and type in the following script and press enter (twice):

You will notice the IDs for the alerts return back to you confirming the number of alerts that have been removed.

$SPwebApp = Get-SPWebApplication “http://SharePoint2010
$SpecificUser = “Domain\Robb.Johnson”
foreach ($SPsite in $SPwebApp.Sites)
{
foreach($SPweb in $SPsite.AllWebs)
{
$alerts = $SPweb.Alerts
if ($alerts.Count -gt 0)
{
$myalerts = @()
foreach ($alert in $alerts)
{
if ($alert.User -like $SpecificUser)
{
$myalerts += $alert
}
}
foreach ($alertdel in $myalerts)
{
$alerts.Delete($alertdel.ID)
write-host $alertdel.ID
}
}
}
}

Replace the Web Application’s URL “http://SharePoint2010” with your own Web Application and replace the user “Domain\Robb.Johnson” with your user on the first two lines of the script.

Leave a Comment