Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get-MailboxStatistics script to display username

Status
Not open for further replies.

disturbedone

Vendor
Sep 28, 2006
781
0
0
AU
Is it possible to use the Get-MailboxStatistics command to display the username rather than the display name?

The following command creates a text file with 3 columns - DisplayName, TotalItemSize(KB) and ItemCount

Code:
Get-MailboxStatistics -database "DBname"| Sort-Object TotalItemSize -descending | ft DisplayName,@{label="TotalItemSize(KB)";expression={$_.TotalItemSize.Value.ToKB()}},ItemCount > C:\reports\mailboxes_DBname.txt

Code:
DisplayName                         TotalItemSize(KB)                 ItemCount
-----------                         -----------------                 ---------
John Smith                                    6201952                    122050
John Doe                                      5290027                     58027
Jane Doe                                      4235569                     81128

But I'd really like to have the AD username/alias too. Like the following:

Code:
Username                         DisplayName                         TotalItemSize(KB)                 ItemCount
----------                        -----------------                           ---------               ----------
SMITHJOHN                               John Smith                             6201952                    122050
DOEJOHN                                   John Doe                             5290027                     58027
DOEJANE                                   Jane Doe                             4235569                     81128

But I can't work out how to do it. I don't actually think it's possible but thought I'd ask. The reason I don't think it's possible is that the only field I can find that's close is LegacyDN but that has a result such as /O=MY COMPANY/OU=EXCHANGE ADMINISTRATIVE GROUP (FYDIBOHF23SPDLT)/CN=RECIPIENTS/CN=SMITHJOHN.

Anyone know if this is possible and how to do it? Or is it just not possible?
 
If you run the "get-mailboxstatistics | fl" command on a single mailbox you will see all of the fields available to you, and the user name is not one of them. If you are good at scripting, which I am not, there is a way to combine the output of the get-mailbox command and that of the get-mailboxstatistics to get what you want. There are tons of scripts out in the ether, and if you search for them you might find what you are looking for.

When all else fails, read the book!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top