【发布时间】:2019-04-27 21:21:25
【问题描述】:
我一直在尝试使用 Powershell 从 Office 365 Exchange 检索基本信息,但我似乎无法在一个命令中获得所有我想要的信息。
如果我使用:
Get-QuarantineMessage -SenderAddress send@domain1.tld -RecipientAddress receive@domain2.tld | Select-Object Identity,SenderAddress,RecipientAddress,Subject,QuarantineTypes,Direction,Expires
我得到了我想要的一切,除了 RecipientAddress:
Identity : eafc9e23-8c21-7a40-2d92-41a9a402abe5\e62c7c5b-7da4-2b79-
e5f4-b902fc927429
SenderAddress : send@domain1.tld
RecipientAddress : {}
Subject : Downtown Events
QuarantineTypes : Spam
Direction : Inbound
Expires : 5/3/2019 1:00:00 PM
我必须在 for 循环中使用相同的命令两次才能得到它:
(Get-QuarantineMessage -SenderAddress send@domain1.tld -RecipientAddress receive@domain2.tld).Identity | ForEach-Object {Get-QuarantineMessage -Identity $_ | Select-Object Identity,SenderAddress,RecipientAddress,Subject,QuarantineTypes,Direction,Expires}
Identity : eafc9e23-8c21-7a40-2d92-41a9a402abe5\e62c7c5b-7da4-2b79-e5f4-b902fc927429
SenderAddress : send@domain1.tld
RecipientAddress : {receive@domain2.tld}
Subject : Downtown Events
QuarantineTypes : Spam
Direction : Inbound
Expires : 5/3/2019 1:00:00 PM
我觉得必须有更好/更优雅的方式来执行此操作,然后运行相同的命令两次。
【问题讨论】:
标签: powershell exchange-server