1

There is three cmd-lets in Exchange EMS:

  • Get-Mailbox - returns object type [Mailbox];
  • Get-MailboxStatistics - returns object type [MailboxStatistics];
  • Get-Recipient - returns object type [ReducedRecipient].

There are some "ID"-like properties in each of these object type. After reading the documentation here, here and here I still do not understand what these IDs mean and which of these properties uniquely determine the mailbox within the organization.
Comparing the output of these three cmdlets on the same mailbox, I see this:

  • [Mailbox].ExchangeGuid = [MailboxStatistics].MailboxGuid = [MailboxStatistics].Identity = [MailboxStatistics].MapiIdentity = [ReducedRecipient].ExchangeGuid
  • [Mailbox].ArchiveGuid = [MailboxStatistics](there is no such property) = [ReducedRecipient].ArchiveGuid
  • [Mailbox].Guid = [MailboxStatistics].MailboxGuid = [ReducedRecipient].Guid

My question is:

  1. Where can i find detailed description for these propreties? MS docuemtation hasn't
  2. Which of these properties can be used to uniquely compare the results of the specified cmdlets?

Thanks!

Posix
  • 11
  • 1
  • Sometimes you can find some information in cmdlets that use these parameters. Example (ExchangeGuid): https://learn.microsoft.com/en-us/powershell/module/exchange/set-mailuser?view=exchange-ps#-exchangeguid If no more information other than "reserved for internal Microsoft use", you have to talk to the developers... – Kael Jul 07 '23 at 06:35

2 Answers2

1

In terms of "which of these properties uniquely determine the mailbox within the organization", the answer realistically is All of them.

AD + Exchange have multiple ways of uniquely referencing an individual user/mailbox. For instance if you search for Get-Mailbox and look at the -Identity parameter, you'll see there are 10 different ways to reference the mailbox, all of which are unique to that specific mailbox.

The main benefit of which is that some other cmdlets may only support a subset of those values, so whatever value you're able to retrieve you can likely pass it to that Exchange cmdlet to get a result.

You can get a feel for what values are available by simply running

Get-Mailbox -Identity <mailbox username> | Select *

which will show all of them, as well as the other properties available from that output.

When scripting, the only time I'd worry too much about which specific value I'm retrieving is when I want to output that value in a useful format to screen or to a log file. When passing the output to another cmdlet, either directly through the pipeline or saving it to a variable to be used later, there's rarely any need to specifically filter out the individual value you think you need. Just reference the object as a whole, and let the cmdlet extract the identity value it wants to use.

For instance, these two options get the same results :

$foo1 = Get-Mailbox -Identity MyUsername | Select -ExpandProperty SamAccountName
Get-MailboxStatistics $foo1

$foo2 = Get-Mailbox -Identity MyUsername
Get-MailboxStatistics $foo2

the only difference being that if for instance the cmdlet you were trying to run didn't support SamAccountName as an identity value (Get-MailboxStatistics does), the first command would fail, but the second would likely work as it could use any of the other identity values it did support from the $foo2 object, for instance DistinguishedName, GUID, UserPrincipalName etc to get the desired result.

Keith Langmead
  • 857
  • 1
  • 7
  • 14
0

Key clarifying paragraphs

  1. Microsoft utilizes property GUID values to assign unique identifiers to objects, similar to a home address, driver's license number, or SSN. These identifiers are used to effectively distinguish and differentiate the objects—you may already know this but wanted to include just in case.

  2. While some cmdlet parameters accept GUID values and return output for that object, it's worth noting that there are other values available or returned that may be more user-friendly if GUID is not explicitly required.

  3. It is important to note that even though one cmdlet's -identity parameter or property may contain a GUID value, it does not imply that the same value will be used for another cmdlet's -identity parameter or property. Different cmdlets can have distinct GUID values for similarly named parameters or properties.

  4. For more comprehensive clarification on each specific cmdlet, refer to the corresponding Microsoft documentation. By reviewing the documentation for the desired cmdlets, drill down into the parameter descriptions to obtain additional detail. See the supporting resources section below for examples.

While there may be correlation between different cmdlets and the data they return for the same mailbox, complex logic in nested foreach loops and calculated properties may be required when the pipeline input is insufficient. It appears that you are primarily seeking clarification rather than specific code to retrieve objects and values per cmdlet for each mailbox, so I have kept my focus on providing clarification.

Supporting Resources

  • Get-Mailbox - returns object type [Mailbox]

    • Pimp Juice IT: Several properties and parameters, including the database and identity properties, accept or return GUID values.

      -Identity

      The Identity parameter specifies the mailbox that you want to view. You can use any value that uniquely identifies the mailbox. For example:

      • Name
      • Alias
      • Distinguished name (DN)
      • Canonical DN
      • Domain\Username
      • Email address
      • GUID
      • LegacyExchangeDN
      • SamAccountName
      • User ID or user principal name (UPN)
  • Get-MailboxStatistics - returns object type [MailboxStatistics]

    • Pimp Juice IT: The Get-MailboxStatistics cmdlet accepts and returns GUID values for certain properties and parameters. It supports pipeline input, enabling you to use commands like Get-Mailbox -Identity user1@domain.com and pipe it directly to Get-MailboxStatistics.
      • This allows you to retrieve statistics for a specific mailbox through the piped command.

      • Make sure to study the parameters to understand how the output of the first command can be processed as input for the second command.

      • Example commands:

        • Get-Mailbox jsmith | Get-MailboxStatistics | Select *;
        • Get-Mailbox jsmith@domain.com | Get-Recipient | Select *;

        -Identity

        The Identity parameter specifies the mailbox that you want to return statistics for. You can use any value that uniquely identifies the mailbox. For example:

        • Name
        • Alias
        • Distinguished name (DN)
        • Canonical DN
        • Domain\Username
        • Email address
        • GUID
        • LegacyExchangeDN
        • SamAccountName
        • User ID or user principal name (UPN)

        Accept pipeline input: True

  • Get-Recipient - returns object type [ReducedRecipient]

    • Pimp Juice IT: Several properties and parameters, including the identity property, accept or return GUID values with this cmdlet too.

      -Identity The Identity parameter specifies the recipient object that you want to view. You can use any value that uniquely identifies the recipient. For example:

      • Name
      • Alias
      • Distinguished name (DN)
      • Canonical DN
      • Email address
      • GUID

      Accept pipeline input: True

Pimp Juice IT
  • 1,077
  • 1
  • 9
  • 16