|
豆子今天重新设置了某个财务软件的邮件配置,需要查询一下是否成功发送。登录Office 365- Admin - Exchange - Mail flow, 设置好条件就可以查询了
然后问题出现了,这个系统显示的时间是UTC的标准时间,而不是我所在地的时间。
根据微软的解释,此事无解,因此作为云服务器,Office365是不知道用户计算机的本地时间的。
https://support.microsoft.com/en-us/kb/2800633
UTC时间看起来太别扭了,豆子觉得还是用Powershell 来获取好了,自己还能重新自定义一下字段。
下面是对应的脚本:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| #加载模块
$cred = Get-Credential "admin@test.com"
Import-Module MSOnline
Set-ExecutionPolicy remotesigned
Connect-MsolService -Credential $cred
#登录连入
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell/ -Credential $Cred -Authentication Basic -AllowRedirection
Import-PSSession $session
#设置搜索的时间段和发件人
$dateEnd = get-date
$dateStart = $dateEnd.AddHours(-1)
$sender="connx@aus.ddb.com"
#自定义时间,转换时区
Get-MessageTrace -StartDate $dateStart -EndDate $dateEnd -SenderAddress $sender| Select-Object @{name='time';e={[System.TimeZone]::CurrentTimeZone.ToLocalTime($_.received)}}, SenderAddress, RecipientAddress, Subject, Status, ToIP, FromIP, Size, MessageID, MessageTraceID | Out-GridView
|
结果如下,可以看见时间已经更改成本地时间了。
|
|