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

[玩转系统] Exchange Online:使用 PowerShell 进行邮件跟踪

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

Exchange Online:使用 PowerShell 进行邮件跟踪


Exchange Online 中的邮件跟踪可以通过图形方式以及在 PowerShell 中执行。在这篇文章中,我将展示如何使用 PowerShell 跟踪消息。您将获得一个可以在您的环境中使用的脚本。让我们开始吧。

先决条件

如果尚未完成,我们需要安装 Exchange Online 管理模块并连接到 Exchange Online。

Install-Module ExchangeOnlineManagement -Force -AllowClobber
Connect-ExchangeOnline

PowerShell 中的消息跟踪

接下来,我将向您展示 4 个示例,说明如何对邮箱执行邮件跟踪,以在控制台、文件或单独的窗口中显示输出。

Get-MessageTrace -SenderAddress [email protected] -StartDate 08/10/2022 -EndDate 08/20/2022 # Max. 10 Tage
Get-MessageTrace -SenderAddress [email protected] -StartDate 08/10/2022 -EndDate 08/20/2022 | Out-GridView
Get-MessageTrace -SenderAddress [email protected] -StartDate 08/10/2022 -EndDate 08/20/2022 | Out-File $home\trace.txt
Get-MessageTrace -SenderAddress [email protected] -StartDate 08/10/2022 -EndDate 08/20/2022 | Export-Csv $home\trace.csv

要显示发送给特定收件人的所有邮件,可以使用此命令。

Get-MessageTrace -RecipientAddress [email protected] -StartDate 08/10/2022 -EndDate 08/20/2022

您不确切知道发件人或收件人地址?没问题,我们可以使用通配符。

Get-MessageTrace -RecipientAddress [email protected] -StartDate 08/10/2022 -EndDate 08/20/2022 | 
Where-Object SenderAddress -like "*.*udemy*"
Get-MessageTrace -SenderAddress [email protected] -StartDate 08/10/2022 -EndDate 08/20/2022 | 
Where-Object RecipientAddress -like "*win*"

请注意,搜索电子邮件仅限于过去 10 天。但是,有一种解决方法,称为历史搜索。

Start-HistoricalSearch -ReportTitle "TestSearch" -StartDate 6/1/2022 -EndDate 8/1/2022 -ReportType MessageTrace `
-SenderAddress [email protected] -NotifyAddress [email protected]
Get-HistoricalSearch

我希望这篇概述对您有所帮助。

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

取消回复欢迎 发表评论:

关灯