Creating users alerts using PowerShell in SharePoint 2010

We had a requirement in SharePoint 2010 to automate the creation of alerts based on SPS group membership. After spending some time searching for solution I have managed to write this code in PowerShell to automate the process. I think it worth sharing with you guys.

Creating users alerts using PowerShell code:

$web = Get-SPWeb "http://eblogin.com"
$group = $web.Groups["eblogin members"]
$list = $web.Lists["eblogin documents"]
foreach ($user in $group.Users){
     $alert = $user.Alerts.Add()
     $alert.Title = "eblogin alerts"
     $alert.AlertType = [Microsoft.SharePoint.SPAlertType]::List
     $alert.List = $list
     $alert.DeliveryChannels = [Microsoft.SharePoint.SPAlertDeliveryChannels]::Email
     $alert.EventType = [Microsoft.SharePoint.SPEventType]::Add
     $alert.AlertFrequency = [Microsoft.SharePoint.SPAlertFrequency]::Immediate
     $alert.Update()
}
$web.Dispose()

You can also change the DeliveryChannels option to SMS  and AlertFrequenct option to Daily. You could run different scripts for your different SharePoint groups.

More Blogs

Contact us

To begin your digital transformation, get in touch.

We’re pleased to address any inquiries you might have and assist you in selecting the service that best suits your requirements.

Your benefits:
Speak To Us