phill
phill

Reputation: 13844

How do you screen for legacy or linked mailboxes?

I've noticed when I pull up exchange management console, it shows mailboxes which have the "Recipient Type Details" as Legacy Mailboxes.

How do I go about querying which ones are legacy, user or linked mailboxes?

I've tried

get-mailbox -identity <displayname> | select deleteditemflags 

but that doesn't seem to work.

Upvotes: 0

Views: 9825

Answers (2)

Shay Levy
Shay Levy

Reputation: 126722

This will get you all Legacy or Linked mailboxes:

Get-Mailbox -resulteSize unlimited -RecipientTypeDetails LegacyMailbox,LinkedMailbox

For just one user:

Get-Mailbox -Identity userName -RecipientTypeDetails LegacyMailbox,LinkedMailbox

EDIT:
Get all mailboxes name and type

Get-Mailbox | Format-Table Name,RecipientTypeDetails

Upvotes: 1

Michael Tucker
Michael Tucker

Reputation: 245

You can get Disabled and Soft-Deleted mailboxes via Get-MailboxStatistics. See this link for details: https://technet.microsoft.com/en-us/library/mt577269(v=exchg.160).aspx

To find hard deleted mailboxes you have to look for a tombstone:

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)
    { ... }
}

Upvotes: 0

Related Questions