Office 365 如何使用powershell查询邮件追踪
如何使用Powershell 对office365的邮件进行查询追踪1. 首先链接到Exchange Online 管理上面
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://partner.outlook.cn/PowerShell -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
2. 查询邮件追踪,导出UTF-8到csv文件中
$dateEnd = get-date
$dateStart = $dateEnd.AddHours(-8) #目前时间之前的8个小时之内
$recipient="admin@constos.com"#导出收件人是admin@constos.com的用户
#自定义时间,转换时区
Get-MessageTrace -StartDate $dateStart -EndDate $dateEnd -RecipientAddress $recipient | Select-Object @{name='time';e={::CurrentTimeZone.ToLocalTime($_.received)}}, SenderAddress, RecipientAddress, Subject, Status, ToIP, FromIP, Size, MessageID, MessageTraceID |export-csv-encoding utf8 d:\Only.csv
页:
[1]