【发布时间】:2016-12-18 20:13:06
【问题描述】:
$exceptionList = Get-Content C:\Users\Dipen\Desktop\Exception_List.txt
$ReceiveLocations = Get-WmiObject MSBTS_ReceiveLocation -Namespace 'root\MicrosoftBizTalkServer' -Filter '(IsDisabled = True)' |
Where-Object { $exceptionList -notcontains $_.Name }
# Exit the script if there are no disabled receive locations
if ($ReceiveLocations.Count -eq 0)
{
exit
}
例子:
和
$mailBodyPT = ""
$mailTextReportPT = "There are: "
[STRING]$Subject = $SubjectPrefix + $BizTalkGroup
$mailTextReportPT += "in the BizTalk group: " + $BizTalkGroup + "."
#Send mail
foreach ($to in $EmailTo)
{
$Body = $HTMLmessage
#$SMTPClient = New-Object Net.Mail.SmtpClient($PSEmailServer)
$message = New-Object Net.Mail.MailMessage($from, $to, $Subject, $Body)
$message.IsBodyHtml = $true;
$SMTPClient.Send($message)
}
问题:当所有 RL 的状态为“已禁用”并且所有这些 RL 都包含在异常列表中时,变量 $ReceiveLocations 的值应该为 false,我需要在我的脚本中停止进一步处理。 (如果在异常列表中找到所有 RL,则不执行任何操作,直接退出)
但我仍然收到虚假电子邮件警报。如果在 $ReceiveLocations 中没有发现额外的 RL,我们如何设置不接收电子邮件警报的逻辑?
【问题讨论】:
标签: powershell biztalk