When I’m planning Exchange Server migrations or just generally reporting on mailbox stats I use my Get-MailboxReport.ps1 script. But sometimes I just want a quick look at how many mailboxes are hosted on each database in the organization. To achieve this we can simply pipe the Get-Mailbox cmdlet into Group-Object.
[PS] C:\>Get-Mailbox | Group-Object -Property:Database | Select-Object Name,Count | Sort-Object Name | Format-Table -Auto Name Count ---- ----- DB02 212 DB05 59 DB06 47 DB07 60 DB08 58
Pingback: Best PowerShell Scripts for Active Directory (For Beginners) - IT Blog Pros
This command didn’t work for me because all my users are in a child domain not in the same domain level as the server, how could i solve this issue.
I too had the same sub-domain issue and was able to resolve it by 1st running the following cmdlet:
Set-ADServerSettings -ViewEntireForest $true
Then run Paul’s cmdlet (include the unlimited switch if necessary):
Get-Mailbox -ResultSize Unlimited | Group-Object -Property:Database | Select-Object Name,Count | Sort-Object Name | Format-Table -Auto
We’re using Exchange 2016 on prem…is there a recommended MAX mailbox per database? We’ve tried to maintain a 300 – 500 mailbox count per DB for client impact in the case of a DB loss or DB corruption.
Now that I have this lists of database names and mailbox count. How would do I go about selecting from a subset of the list. that is, data base names. Then find the smallest mailbox count among that subset of databases. End result would be to create a new user mailbox in the correct database subset and place it in the lowest database count.
thank you
This is what I have used previously:
$DBS = Get-Mailbox | Group-Object -Property Database | Sort-Object Count;
$EXCHDB = $DBS[0]
This gives you the Databases sorted by mailbox count and then you can select the first object in the array which will contain the least
How to view the users and its associated databases through cmd command.
Is there a quick way to tie in get-mailboxstatistics to get the totalitemsize?
Hi All,
How do I count external mailboxes and internal mailboxes?
The Real Person!
The Real Person!
What are “internal” and “external” mailboxes by your definition?
I would make a note that if you’re dealing with over 1000 mailboxes you need to use get-mailbox -resultsize unlimited