Disable Alerts on SharePoint 2013 List using PowerShell

Requirement: Temporarily disable Alert Emails on a SharePoint list.

how to disable alerts in sharepoint using powershell

How to disable alerts on a SharePoint list?

SharePoint Alert objects have “Status” property which can be turned ON or OFF. As there is no UI to disable or enable alerts in SharePoint directly from the browser, we can do it programmatically with PowerShell. Here is my PowerShell script to disable alerts on SharePoint 2010/2013 list or library.

Important: This script disables ONLY existing alerts in a specific list or library! It doesn’t (of course, can’t!) disable any new alerts you create on the particular list! You may have to temporarily turn-off alerts on web application level by changing the flag “AlertsEnabled” to “false” as in How to Disable Alerts in SharePoint

PowerShell script to Disable alerts on SharePoint list

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Function to Disable All Active Alerts on a Given List
Function Disable-ListAlerts($WebURL, $ListName)
{
    #Get the Web and List objects
    $Web = Get-SPWeb $WebURL
    $List = $web.Lists.TryGetList($ListName)

    #Get All Alerts created in the list - Which are Active
    $ListAlerts = $Web.Alerts | Where-Object {($_.List.Title -eq $List.Title) -and ($_.Status -eq "ON")}

    Write-host "Total Number of Active Alerts Found in the list: $($ListAlerts.Count)" 
    
    #Iterate through each alert and turn it OFF
    foreach($Alert in $ListAlerts)
        {
            $Alert.Status="OFF"
            $Alert.Update()
            write-host "Disabled the Alert' $($Alert.Title)' Created for User '$($Alert.User.Name)'"
        }
         
    #Dispose web object
    $Web.Dispose()
}

#Function to Enable all Disable Alerts on a Given List
Function Enable-ListAlerts($WebURL, $ListName)
{
    #Get the Web and List objects
    $Web = Get-SPWeb $WebURL
    $List = $web.Lists.TryGetList($ListName)

    #Get All Alerts created in the list - Which are in Disabled State
    $ListAlerts = $Web.Alerts | Where-Object { ($_.List.Title -eq $List.Title) -and ($_.Status -eq "OFF")}

    Write-host "Total Number of Disabled Alerts Found in the list: $($ListAlerts.Count)" 
    
    #Iterate through each alert and turn it OFF
    foreach($Alert in $ListAlerts)
        {
            $Alert.Status="ON"
            $Alert.Update()
            write-host "Enabled the Alert' $($Alert.Title)' Created for User '$($Alert.User.Name)'"
        }
         
    #Dispose web object
    $Web.Dispose()
}

#Variables
$WebURL = "https://operations.crescent.com/"
$ListName="Proposal Documents"

#Call the function Appropriately to Disable or Enable Alerts 
Disable-ListAlerts $WebURL $ListName

#To Enable it back
#Enable-ListAlerts $WebURL $ListName
Please note, You have to wait for Five minutes before enabling the alerts again (Because the Immediate alert timer job looks for items modified in past Five minutes). Otherwise, You’ll get Emails from disabled alerts! So: Disable Alerts – Do the changes to data – Wait for Five Minutes – Enable alerts again.

Related Posts:

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

5 thoughts on “Disable Alerts on SharePoint 2013 List using PowerShell

  • Hi, will this work with SharePoint Online ?

    Reply
  • Excellent start, thank you. But this approach will enable alerts that were already disabled before the first function runs. I’ll have to try to store those and then re-enable only the ones that this function disabled. Have to create an array with global scope maybe.

    Reply
    • I thought that too, so I created an array that I returned from the the delete function and fed back into the Enable function. The problem I’m having is that despite disabling the alerts, deleting the items, then re-enabling the alerts it doesn’t seem to take effect and alerts are still sent 🙁 I guess because we’re doing everything inside of the same 5 minute window between the timer job firing.

      We need something that will prevent the event from being written to the event table in the DB…

      Reply
  • Great Blog with excellent PowerShell scripts. Bookmarked!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *