如何通过powershell检查交换邮箱? [英] How to check an exchange mailbox via powershell?

查看:38
本文介绍了如何通过powershell检查交换邮箱?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将如何使用 powershell 将收到的最后 5 条消息的文本和标题返回到我的 Exchange 电子邮件帐户?有没有简单的方法/库可以做到这一点?

How would I go about using powershell to return the text and headers of the last 5 messages received to my exchange email account? Is there a simple way/library to do this?

这与我关于不在超级用户上使用 Outlook 的问题有关.除了没有找到任何好的替代方案,我认为我还不如编写自己的简单的 powershell 客户端.

This is related to my question about not using outlook on superuser. Except that having not found any good alternatives I figure I might as well write my own simple powershell client.

推荐答案

您需要拥有 EWS API 已安装,您需要检查反射程序集加载部分中 DLL 的路径.

You'll need to have the EWS API installed, and you'll need to check the path to the DLL in the Reflection Assembly load portion.

这将使您能够使用 $inbox.FindItems(5) 语句并从中过滤出您想要的结果.

This should get you to the point where you're able to work with the $inbox.FindItems(5) statement and filter the results you want out of that.

[Reflection.Assembly]::LoadFile("C:Program FilesMicrosoftExchangeWeb Services1.0Microsoft.Exchange.WebServices.dll")
$s = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2007_SP1)
$s.Credentials = New-Object Net.NetworkCredential('user', 'pass', 'domain')
$s.AutodiscoverUrl("email@address.com")

$inbox = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($s,[Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox)
$inbox.FindItems(5)

这篇关于如何通过powershell检查交换邮箱?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆