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

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

问题描述

如何使用powershell将收到的最近5条消息的文本和标题返回到我的交换电子邮件帐户?有没有一个简单的方法/图书馆这样做?

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 ,你会需要检查Reflection Assembly加载部分中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)

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

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