$servers =
"Server1","Server2"
$filepath =
"C:\Scripts\"
$date =
"{0:dd-MM-yyyy_HH-mm}" -f (get-date)
$file = $filepath +
"ErrorLogs_" + $date + ".txt"
New-Item $filepath
-type directory -force -Verbose
foreach($server in
$servers)
{
$server | Out-File
$file -Append
Get-Eventlog -log
"Lync Server" -cn $Server -after ((get-date).addDays(-1)) -EntryType
Error | Out-File $file -append
}
Send-MailMessage -To
"anilkumar.nudurupati@testlab.com","anilkumar.nudurupati@testlab.com"
-From "Lync.Monitoring@testlab.com" -Subject "Lync Server
Events" -Attachments "$file" -SmtpServer "10.1.1.0"