Enabling Alerts in SharePoint 2013 - PowerShell Commands

Lets say you have a SharePoint group named "Notify Members". They would like to receive an alert when a document is added to the document library "Business document". Here are list of PowerShell Commands to achieve the functionality.
 
$web = Get-SPWeb "http://localhost/mysite/"
$group = $web.Groups["Notify Members"]
$list = $web.Lists[" Business document"]
foreach ($user in $group.Users){
     $alert = $user.Alerts.Add()
     $alert.Title = "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()
Ebook Download
View all
Learn
View all