当我的交换队列达到最大消息数时,我想获得有关 get-queue 的完整详细信息的通知,这就是我现在拥有的内容,它为您提供了详细信息,但格式不正确。
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
这是我收到通知时格式不明确的输出:-
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...