In the previous article I show you how you can add a new alert in your SharePoint by PowerShell, with the following snip of code you can get the list of the alerts on your site
clear
$webAppUrl = Read-Host -Prompt "Url Web Application: "
if ($webAppUrl.Length -ile 0) {
$webAppUrl = "http://yoursitecollection:17927/sites/yoursite"
}
$web = Get-SPWeb $webAppUrl
$myalerts = @()
$alerts = $web.Alerts
Write-Host "Prints alerts and some properties"
foreach ($alert in $alerts) {
if ($alert.User.LoginName.Contains("raise") -eq "True") {
continue
}
"Status - " + $alert.Status
"Title - " + $alert.Title
"User ID - " + $alert.User.ID
"User Name - " + $alert.User.Name
"User Login - " + $alert.User.LoginName
"Frequency - " + $alert.AlertFrequency
"List - " + $alert.List.Title
Write-Host "_____________________"
$myalerts += 1
}
Write-Host "Num of alerts: " $myalerts.Count
Enjoy!
No comments:
Post a Comment