$session = New-PSSession -ConfigurationName microsoft.exchange -ConnectionUri http://ph-cdo-caexch01.gbsorg.net/powershell -Authentication kerberos
Import-PSSession $session
$isTherePossibleQueue = $false
$emailBody = "";
foreach ($databaseQueueEntry in get-queue) {
if ($databaseQueueEntry.MessageCount -ge 1) {
$isTherePossibleQueue = $true
$emailBody += "Queue ID: " + $databaseQueueEntry.Identity + " Count:" + $databaseQueueEntry.MessageCount + "`n"
}
}
if ($isTherePossibleQueue) {
$smtpServer = "cdo-zimbra01.gbsorg.net"
$msgSender = New-Object Net.Mail.SmtpClient($smtpServer)
$msgComposition = New-Object Net.Mail.MailMessage
$msgComposition.From = "exchange-hubcas@concentrix.com"
$msgComposition.ReplyTo = "windows_administrators@concentrix.com"
$msgComposition.To.Add("sheen.lim@concentrix.com")
$msgComposition.Subject = "Possible High Mail Queue"
$msgComposition.Body = $emailBody
$msgSender.Send($msgComposition)
}
I'm having problem with my code in line
$emailBody += "Queue ID: " + $databaseQueueEntry.Identity + " Count:" + $databaseQueueEntry.MessageCount + "`n"
because what i receive in email is a straight line. that is suppose to be a new line per database queue entry.
Isnt `n the newline character in powershell?