当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] Exchange Online 邮件跟踪与本地搜索不同

作者:精品下载站 日期:2024-12-14 04:06:08 浏览:11 分类:玩电脑

Exchange Online 邮件跟踪与本地搜索不同


在云端追踪电子邮件

十年前,Paul Cunningham 描述了如何使用 PowerShell 搜索 Exchange Server 邮件跟踪日志,以查找通过传输服务时记录的电子邮件的详细信息。该文章重点介绍 Exchange Online 中不存在的 Get-MessageTrackingLog cmdlet。需要一种不同的技术来运行 Exchange Online 消息跟踪并在云中查找消息,其中 Get-MessageTrace cmdlet 负责完成繁重的工作。虽然您可以通过 Exchange 管理中心 GUI 运行消息跟踪,但通过 PowerShell 运行跟踪允许您将结果通过管道传输到其他 cmdlet、创建报告等(以下是使用消息跟踪创建报告以进行管理的示例)外部电子邮件)。

需要记住的一件大事是,Get-MessageTrace 可以在消息发送后最多十天内返回有关消息的信息。之后,必须使用 Start-HistoricalSearch cmdlet。另一点是,发送邮件后需要几分钟时间,Exchange Online 才能跟踪其进度。

保罗的文章使用了一封有关发送给三个收件人的工资报告的电子邮件作为测试用例。图 1 显示了我的示例:

[玩转系统] Exchange Online 邮件跟踪与本地搜索不同

按发件人电子邮件地址进行 Exchange Online 邮件跟踪

任何搜索返回的结果取决于用于查找项目的条件。首先,我们可以通过在 Sender 参数中包含用户的主 SMTP 地址来查找用户发送的邮件。

Get-MessageTrace -SenderAddress [email protected] -StartDate (Get-Date).AddHours(-1) -EndDate (Get-Date)

Received            Sender Address                    Recipient Address                  Subject
--------            --------------                    -----------------                  -------
11/06/2022 10:24:22 [email protected] [email protected]     Attention: May Payroll Details
11/06/2022 10:24:22 [email protected] [email protected]   Attention: May Payroll Details
11/06/2022 10:24:22 [email protected] [email protected] Attention: May Payroll Details

此信息在 Exchange 传输系统如何处理邮件方面提供的信息与 Get-MessageTrackingLog cmdlet 所提供的信息不同。您可以将 Status 参数添加到搜索中,以返回具有特定处理状态的邮件。例如,此命令仅返回已成功发送的消息。其他状态值包括失败、待处理和隔离。

Get-MessageTrace -SenderAddress [email protected] -StartDate (Get-Date).AddHours(-1) -EndDate (Get-Date) -Status Delivered

要查看有关处理步骤的更多详细信息,我们需要消息跟踪标识符Get-MessageTrace 不会显示消息跟踪标识符,除非您要求:

Get-MessageTrace -SenderAddress [email protected] -StartDate (Get-Date).AddHours(-1) -EndDate (Get-Date) | Format-table MessageTraceId, SUbject, RecipientAddress

MessageTraceId                       Subject                        RecipientAddress
--------------                       -------                        ----------------
1b312cde-f274-409e-7350-08da4b948d74 Attention: May Payroll Details [email protected]
1b312cde-f274-409e-7350-08da4b948d74 Attention: May Payroll Details [email protected]
1b312cde-f274-409e-7350-08da4b948d74 Attention: May Payroll Details [email protected]

现在我们可以运行Get-MessageTraceDetail来发现消息发生了什么。

Get-MessageTraceDetail -MessageTraceId  1b312cde-f274-409e-7350-08da4b948d74 -RecipientAddress [email protected]

Date                   Event                Detail
----                   -----                ------
11/06/2022 10:24:23    Receive              Message received by: PAXPR04MB8621.eurprd04.prod.outlook.com
11/06/2022 10:24:23    Submit               The message was submitted.
11/06/2022 10:24:27    Deliver              The message was successfully delivered.

通过收件人电子邮件地址跟踪邮件

无论邮件收件人是什么类型的收件人(TO、CC 或 BCC),按收件人搜索都有效。这里我们搜索Chris Bishop(一个CC地址),搜索成功:

Get-MessageTrace -RecipientAddress [email protected] -StartDate (Get-Date).AddHours(-1) -EndDate (Get-Date) | Format-List

Message Trace ID  : 1b312cde-f274-409e-7350-08da4b948d74
Message ID        : <DB6PR04MB3158B4FBF516094B399D23C0B4A99@DB6PR04MB3158.eurprd04.prod.outlook.com>
Received          : 11/06/2022 10:24:22
Sender Address    : [email protected]
Recipient Address : [email protected]
From IP           : 2a01:cb1d:5b0:1500:fd9f:cfb5:a3e6:e6cb
To IP             :
Subject           : Attention: May Payroll Details
Status            : Delivered
Size              : 57013

您可以通过用逗号分隔收件人地址来指定多个收件人 SMTP 地址。当你这样做时,条件是“或”而不是“和”。换句话说,发送给任何一个收件人的任何消息都包含在结果中。在本例中,我们查找发送到两个邮箱的邮件,其中之一是工资电子邮件的收件人。消息跟踪发现两条消息:

Get-MessageTrace -RecipientAddress [email protected], [email protected] -StartDate (Get-Date).AddHours(-1) -EndDate (Get-Date) | fl

Message Trace ID  : 92827190-e015-4faf-586f-08da4b972420
Message ID        : <DB6PR04MB315846EE7664C474A7435554B4A99@DB6PR04MB3158.eurprd04.prod.outlook.com>
Received          : 11/06/2022 10:42:54
Sender Address    : [email protected]
Recipient Address : [email protected]
From IP           : 2a01:cb1d:5b0:1500:fd9f:cfb5:a3e6:e6cb
To IP             :
Subject           : Business Development Meeting
Status            : Delivered
Size              : 12933

Message Trace ID  : 1b312cde-f274-409e-7350-08da4b948d74
Message ID        : <DB6PR04MB3158B4FBF516094B399D23C0B4A99@DB6PR04MB3158.eurprd04.prod.outlook.com>
Received          : 11/06/2022 10:24:22
Sender Address    : [email protected]
Recipient Address : [email protected]
From IP           : 2a01:cb1d:5b0:1500:fd9f:cfb5:a3e6:e6cb
To IP             :
Subject           : Attention: May Payroll Details
Status            : Delivered
Size              : 57013

通配符值或部分匹配的消息跟踪

Get-MessageTrackingLog cmdlet 不支持针对 SenderAddressRecipientAddress 参数进行通配符搜索。但是,Get-MessageTrace 可以运行如下搜索(该示例查找在定义的时间段内发送到 microsoft.com 地址的任何消息):

Get-MessageTrace -RecipientAddress *@microsoft.com -StartDate 3-June-2022 -EndDate 10-June-2022 -Status Delivered

您还可以对发件人地址运行通配符搜索。例如,以下是如何查找上周从 quest.com 发送给我的租户的所有消息。结果涵盖从 quest.com 地址发送到租户中任何启用邮件的收件人的所有消息:

Get-MessageTrace -SenderAddress *@quest.com -StartDate (Get-Date).AddDays(-7) -EndDate (Get-Date) -Status Delivered | ft senderaddress, recipientaddress, subject, status

按主题的消息跟踪

遗憾的是,Get-MessageTrace cmdlet 不包含主题参数来允许搜索具有匹配主题的特定消息。通过将搜索结果传送到 Where-Object cmdlet,可以轻松克服此缺陷。例如,以下是如何获取从 Quest.com 收到的一组消息并仅匹配消息主题中包含字符串“Zero-day”的消息:

Get-MessageTrace -SenderAddress *@quest.com -StartDate (Get-Date).AddDays(-7) -EndDate (Get-Date) -Status Delivered  | ? {$_.Subject -like "*Zero-day*"}

概括

云中的消息跟踪有所不同。本地服务器通常可以更好地控制日志保持可用的时间,而云系统往往将信息保留在更有限的时间内在线。 Get-MessageTrace cmdlet 的使用与 Get-MessageTrackingLog cmdlet 不同,但不需要太多时间就能熟练掌握其功能。

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯