如何筛选旧邮箱或链接邮箱?

时间:2009-02-06 23:24:20

标签: exchange-server exchange-management-shell

我注意到,当我启动Exchange管理控制台时,它会显示将“收件人类型详细信息”作为旧邮箱的邮箱。

如何查询哪些是旧邮箱,用户邮箱或链接邮箱?

我试过

get-mailbox -identity <displayname> | select deleteditemflags 

但这似乎不起作用。

2 个答案:

答案 0 :(得分:1)

这将为您提供所有旧邮箱或链接邮箱:

Get-Mailbox -resulteSize unlimited -RecipientTypeDetails LegacyMailbox,LinkedMailbox

仅限一位用户:

Get-Mailbox -Identity userName -RecipientTypeDetails LegacyMailbox,LinkedMailbox

编辑:
获取所有邮箱名称和类型

Get-Mailbox | Format-Table Name,RecipientTypeDetails

答案 1 :(得分:0)

您可以通过Get-MailboxStatistics获取已禁用和软删除的邮箱。有关详情,请参阅此链接: https://technet.microsoft.com/en-us/library/mt577269(v=exchg.160).aspx

要查找硬删除的邮箱,您必须查找墓碑:

var path = "GC://{YourGlobalCatalogFQDN}";
var root = new DirectoryEntry(path, username, password);
var filter = "(objectClass=person)(isDeleted=TRUE)(msExchMailboxGuid=*)(cn=*)";          //tombstone mailboxes don't have 'objectCategory' property
var props = "objectClass sAMAccountName objectGUID msExchMailboxGuid cn whenChanged isDeleted".Split(' ');   //tombstone mailboxes don't have 'mail' property
var ds = new DirectorySearcher(root, filter, props, SearchScope.Subtree);
ds.Tombstone = true;
using (var mailboxes = ds.FindAll())
{
    foreach (SearchResult mailbox in mailboxes)
    { ... }
}