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

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

问题描述

我会如何使用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 Files\Microsoft\Exchange\Web Services\1.0\Microsoft.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的Exchange邮箱?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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