0

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.

Gary
  • 13,303
  • 18
  • 49
  • 71
phill
  • 13,434
  • 38
  • 105
  • 141

2 Answers2

1

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
Gary
  • 13,303
  • 18
  • 49
  • 71
Shay Levy
  • 121,444
  • 32
  • 184
  • 206
  • How do you filter out users who have been tombstoned (marked for deletion) for later purging? – phill Feb 17 '09 at 22:44
0

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)
    { ... }
}
Michael Tucker
  • 205
  • 2
  • 10