Monday 14 May 2018

Export User Subscribed Alerts to CSV PowerShell




Export Alerts to CSV file using PowerShell

cls

asnp "*sh*"

$web=Get-SPWeb http://msdev02dp:3636/

$alertCollection = @()

 foreach($alert in $web.Alerts)
{

$ExportItem = New-Object PSObject

$ExportItem | Add-Member -MemberType NoteProperty -name "UserName" -value $alert.User.DisplayName

$ExportItem | Add-Member -MemberType NoteProperty -Name "Email" -value $alert.User.Email

$ExportItem | Add-Member -MemberType NoteProperty -name "Title" -value $alert.Title

$ExportItem | Add-Member -MemberType NoteProperty -name "EventType" -value $alert.EventType

$ExportItem | Add-Member -MemberType NoteProperty -name "Frequency" -value $alert.AlertFrequency

$alertCollection += $ExportItem

}

  $alertCollection | Export-CSV "D:\Useralerts.csv" -NoTypeInformation


  $web.Dispose()