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

[玩转系统] 使用 PowerShell 获取 Exchange Online 邮件流量报告

作者:精品下载站 日期:2024-12-14 18:31:32 浏览:15 分类:玩电脑

使用 PowerShell 获取 Exchange Online 邮件流量报告


公司想知道他们一小时或一天收到多少封电子邮件。也许他们想要收集入站邮件和出站邮件总数以进行分析。使用 PowerShell 中的 Get-MailTrafficATPReport cmdlet,我们可以检查入站和出站邮件总数以及更多信息。让我们详细了解如何使用 PowerShell 获取 Exchange Online 邮件流量报告。

连接到 Exchange Online PowerShell

以管理员身份运行 Windows PowerShell 并连接到 Exchange Online PowerShell。

PS C:\> Connect-ExchangeOnline

连接后,我们继续下一步。

获取邮件流量报告

运行 Get-MailTrafficATPReport cmdlet。它将输出 Exchange Online 流量摘要,并显示最近 7 天的流量。

注意Get-MailTrafficATPReport cmdlet 仅适用于 Exchange Online,不适用于本地 Exchange。

PS C:\> Get-MailTrafficATPReport

Date                Event Type      Direction Verdict Source Message Count
----                ----------      --------- -------------- -------------
07/06/2023 00:00:00 General filter  Inbound   Phish          3            
06/06/2023 00:00:00 General filter  Inbound   Phish          2            
06/06/2023 00:00:00 General filter  Inbound   Spam           1            
06/06/2023 00:00:00 Message passed  Inbound   NotSpam        1            
05/06/2023 00:00:00 Advanced filter Inbound   Phish          1            
05/06/2023 00:00:00 Advanced filter Inbound   Spam           1            
03/06/2023 00:00:00 Advanced filter Inbound   Phish          3            
02/06/2023 00:00:00 Message passed  Inbound   NotSpam        16           
02/06/2023 00:00:00 Message passed  IntraOrg  Allow          25           
02/06/2023 00:00:00 Message passed  IntraOrg  NotSpam        4            
02/06/2023 00:00:00 Message passed  Outbound  NotSpam        9        

让我们更详细地了解一下,获取入站和出站的单独邮件报告。

获取入站邮件流量报告

按天过滤报告

按天过滤入站邮件。

在此示例中,我们选择了 2023 年 6 月 2 日。

PS C:\> Get-MailTrafficATPReport -Direction "Inbound" -StartDate "06/02/2023 00:00" -EndDate "06/03/2023 00:00"

Date                Event Type     Direction Verdict Source Message Count
----                ----------     --------- -------------- -------------
02/06/2023 00:00:00 Message passed Inbound   NotSpam        16           

按好邮件过滤报告

按事件类型消息已传递过滤邮件流量报告。

消息已传递消息在通过恶意软件和垃圾邮件过滤器后传递。此计数显示唯一消息的数量。如果一条消息被发送给多个收件人,它仍将被视为一条消息。

PS C:\> Get-MailTrafficATPReport -Direction "Inbound" -StartDate "06/02/2023 00:00" -EndDate "06/03/2023 00:00" -EventType "Message Passed"

Date                Event Type     Direction Verdict Source Message Count
----                ----------     --------- -------------- -------------
02/06/2023 00:00:00 Message passed Inbound   NotSpam        16           

按小时过滤报告聚合

添加值为 HourAggregateBy 参数。

AggregateBy 参数指定报告周期。有效值为小时、天或摘要。默认值为日。

PS C:\> Get-MailTrafficATPReport -Direction "Inbound" -StartDate "06/02/2023 00:00" -EndDate "06/03/2023 00:00" -EventType "Message Passed" -AggregateBy "Hour"

Date                Event Type     Direction Verdict Source Message Count
----                ----------     --------- -------------- -------------
02/06/2023 09:00:00 Message passed Inbound   NotSpam        2            
02/06/2023 10:00:00 Message passed Inbound   NotSpam        12           
02/06/2023 21:00:00 Message passed Inbound   NotSpam        2            

按月过滤报告

您想查看上个月的入站邮件有多少好邮件吗?让我们来看看上个月,2023 年 5 月,也就是 31 天的好邮件。

PS C:\> Get-MailTrafficATPReport -Direction "Inbound" -StartDate "05/01/2023 00:00" -EndDate "05/31/2023 00:00" -EventType "Message Passed"

按月获取入站消息总数

让我们看看 2023 年 5 月入站的好邮件有多少封。

添加 Measure-Object cmdlet 以计算平均值、总和、最大值和最小值数值。我们可以看到 2023 年 5 月的入站邮件总数为 77539 条消息。

PS C:\> Get-MailTrafficATPReport -Direction "Inbound" -StartDate "05/01/2023 00:00" -EndDate "05/31/2023 00:00" -EventType "Message Passed" -AggregateBy Day | Measure-Object "MessageCount" -Average -Sum -Maximum -Minimum

Count    : 31
Average  : 2501,25806451613
Sum      : 77539
Maximum  : 5030
Minimum  : 439
Property : MessageCount

一切看起来都很棒。让我们做同样的事情,但这次是针对出站邮件流量。

获取出站邮件流量报告

按天过滤报告

按天过滤出站邮件。与之前的 cmdlet 之间的唯一区别是设置值 Outbound 而不是 Inbound

在此示例中,我们选择了 2023 年 6 月 6 日。

PS C:\> Get-MailTrafficATPReport -Direction "Outbound" -StartDate "06/02/2023 00:00" -EndDate "06/03/2023 00:00"

Date                Event Type     Direction Verdict Source Message Count
----                ----------     --------- -------------- -------------
02/06/2023 00:00:00 Message passed Outbound  NotSpam        9            

按好邮件过滤报告

按事件类型消息已传递过滤邮件流量报告。

PS C:\> Get-MailTrafficATPReport -Direction "Outbound" -StartDate "06/02/2023 00:00" -EndDate "06/03/2023 00:00"

Date                Event Type     Direction Verdict Source Message Count
----                ----------     --------- -------------- -------------
02/06/2023 00:00:00 Message passed Outbound  NotSpam        9            

按小时过滤报告聚合

添加值为 HourAggregateBy 参数。

PS C:\> Get-MailTrafficATPReport -Direction "Outbound" -StartDate "06/02/2023 00:00" -EndDate "06/03/2023 00:00" -AggregateBy "Hour"

Date                Event Type     Direction Verdict Source Message Count
----                ----------     --------- -------------- -------------
02/06/2023 10:00:00 Message passed Outbound  NotSpam        9     

按月过滤报告

获取上个月(2023 年 5 月)的好邮件,即 31 天。

PS C:\> Get-MailTrafficATPReport -Direction "Outbound" -StartDate "05/01/2023 00:00" -EndDate "05/31/2023 00:00" -EventType "Message Passed"

按月获取出站消息总数

2023 年 5 月的出站总数为 131639 条消息。

PS C:\> Get-MailTrafficATPReport -Direction "Outbound" -StartDate "05/01/2023 00:00" -EndDate "05/31/2023 00:00" -EventType "Message Passed" -AggregateBy Day | Measure-Object "MessageCount" -Average -Sum -Maximum -Minimum

Count    : 31
Average  : 4246,41935483871
Sum      : 131639
Maximum  : 8878
Minimum  : 251
Property : MessageCount

就是这样!

了解更多:如何将 Microsoft 365 中的域列入白名单 »

结论

您了解了如何使用 PowerShell 获取 Exchange Online 邮件流量报告。通过运行 Get-MailTrafficATPReport cmdlet,您将获得包含大量信息的不同邮件流量报告。我们正在寻找每月传递的入站(传入)和出站(传出)消息的总数。

您喜欢这篇文章吗?您可能还喜欢获取比 Office 365 更大的邮箱大小。不要忘记关注我们并分享这篇文章。

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

取消回复欢迎 发表评论:

关灯