i want to get the notification of full details of get-queue when my exchange queue reaches maximum message count , here is what i have now which give you the details but not in correct format.
function check_queue
{
$a = get-queue | measure-object MessageCount -max
$b = Get-Queue | Out-File -filepath C:\getQueue.txt
if ($a.Maximum -gt 1000)
{
send_email $a.Maximum
}
}
function send_email
{param ($queue_size)
$emailFrom = "exchange@xyz.com"
$emailTo = "test@xyz.com"
$subject = "Exchange Max Mail QUEUE"
$body = Get-Queue | Out-String
$smtpServer = "mail.xyz.com"
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($emailFrom, $emailTo, $subject, $body)
}
check_queue
here is the output which is not clear in the format when i get the notification:-
Identi DeliveryType Status MessageCount Velocity RiskLevel OutboundIPPool NextH
ty opDom
ain
------ ------------ ------ ------------ -------- --------- -------------- -----
xy... SmtpDeliv... Ready 0 0 Normal 0 ma...
xy... SmtpDeliv... Ready 0 0 Normal 0 ma...
xy... SmtpDeliv... Ready 0 0 Normal 0 ma...
xy... SmtpDeliv... Ready 0 0 Normal 0 ma...
xy... SmtpRelay... Ready 0 0 Normal 0 ed...
xy... Undefined Ready 0 0 Normal 0 Su...
xy... ShadowRed... Ready 20 0 Normal 0 gr...