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

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

About Us

Follow Us

Email: contact@keapoint.com
Phone:  0208 7852 888

Registered Address: 1 Amber Close, Reading, RG6 7ED. United Kingdom

Company No. 11586817