Create an Alert Using PowerShell in SharePoint 2010

In this article I will show you how to create multiple alerts in just a few seconds in a Document Library.

I won't take much of your time.

Kindly find the script below that you need to change. 

  • URL
  • Document Library name
  • User name with full control
  • Alert Name 


  1. $site = Get-SPSite "Add your url here"  
  2. $web=$site.Rootweb  
  3. $list=$web.Lists.TryGetList("Add your document library")  
  4. $user = $web.EnsureUser('Domain\user')  
  5. $newAlert = $user.Alerts.Add()  
  6. $newAlert.Title = "Add your alert name here"  
  7. $newAlert.AlertType=[Microsoft.SharePoint.SPAlertType]::List  
  8. $newAlert.List = $list  
  9. $newAlert.DeliveryChannels = [Microsoft.SharePoint.SPAlertDeliveryChannels]::Email   
  10. $newAlert.EventType = [Microsoft.SharePoint.SPEventType]::Add  
  11. $newAlert.AlertFrequency = [Microsoft.SharePoint.SPAlertFrequency]::Immediate   
  12. $newAlert.Update()  
  1. Open Windows PowerShell Modules using Run as Administrator.

  2. Paste in the preceding the code.

    Windows PowerShell Modules

  3. Click Enter.

  4. After running go to the respective Document Library.

    document library

  5. On the top you can see an alert me icon.

    alert me

  6. Click on it.

  7. A drop down comes up with buttons like Set alert on this library that is a manual process but you have already automated it.

  8. Go to Manage my alerts.

    Manage my alerts

  9. You will see your custom alert created by PowerShell.

  10. As for me it is ”Alert by PowerShell”.

    My Alerts on this site
Isn't it quick?

Keep learning!


Similar Articles