Mailbox statistics with mailbox database quotas

Email statistics and Mailbox database quotas
You might have an interest in attaining information such as mailbox details, mailbox statistics and mailbox database details from Exchange server. At that point, knowing how to retrieve this information from the Exchange management shell becomes essential. The purpose of this article is to provide instructions to enable you retrieve this information from your server with ease.
Mailbox details
When you run the get-mailbox command, you will be provided with a list of attributes that you can use to access any area of interest. All you need to do at this point is type out get-mailbox | fl and the attribute of interest. For example, if you were interested in knowing the database the mailbox belongs to, you will type the get-mailbox | fl command, you will then notice that database is attribute one on that list, and then you will type the command get-mailbox | fl
For example when you run Get-mailbox command you will see the below details (Listed only important attributes).
1. Database
2. Use Database Quota Defaults True/False
3. Server Name Currently mounted server
4. Sam Account Name Login name
5. Server Legacy DN lygacyExcahgeDN(AD database)
6. Address Book Policy Address book policy to get a custom addressbook for specific users
7.RetentionPolicy
8. Alias
9. Display Name
10. Email Addresses
11. Primary Smtp Address Primary email in which all emails send from
Check this for details
https://technet.microsoft.com/en-us/library/bb123685(v=exchg.160).aspx
Mailbox statistics details
You might be interested in retrieving more information about your mailbox. For example, you might want to know the size of the mailbox, the number of messages that it contains or the last time someone accessed the mailbox. So, you will need to know how to run the mailbox statistics command to retrieve mailbox statistics information only. The syntax for this will be Get-mailbox Statistics | fl interest.
For example when you run Get-Mailbox statistics command you will see the below details (Listed only important attributes).
1. Associated Item Count Things that are “associated” with a folder, usually other file-like things not visible to users.
2. DeletedItemCount
3. Display Name
4. ItemCount
5. LastLoggedOnUserAccount
6. LegacyDN
7.StorageLimitStatus
8. TotalDeletedItemSize
9. TotalItemSize
10. Database
11. ServerName
12. IsValid If valid it will show you “True” else “False”
Check this for details
https://technet.microsoft.com/en-us/library/bb124612(v=exchg.160).aspx
Mailbox Database quotas details
When you run mailboxdatabase command you will see mailboxdatabase details only.
For example when you run Get-mailboxdatabase command you will see the below details (Listed only iImportant attributes)
1. ProhibitSendReceiveQuota
2. ProhibitSendQuota
3. IssueWarningQuota
4. RpcClientAccessServer
5. MountAtStartup
6. Organization
7. ServerName
8. Name
9. LogFolderPath
10. CircularLoggingEnabled
11. IsMailboxDatabase
12. IsPublicFolderDatabase
13. AdminDisplayName
14. IsValid
Check this for details
https://technet.microsoft.
Some users/clients require results of command get-mailbox, get-mailboxstatistics and get-mailboxdatabase.
In most cases “UseDatabaseQuotaDef
Finally I am piping all the above commands to one script to get an output of get-mailbox, get-mailboxstatistics and getmailboxdatabase commands to get Name, Emailaddress, useDatabaseQuotaDefaults(f
The below script is without formatting which will give you results of Get-mailbox, Get-mailboxstatistics, Get-mailboxdatabase.
$u = Get-Mailbox foreach ($m in $u) { $TotalItemSize = @{n="TotalSize"; e={if ( (Get-MailboxStatistics -Identity $m).TotalItemSize.Value) { (Get-MailboxStatistics -Identity $m).TotalItemSize.Value.ToMB() } else {"-"}}} $ProhibitSendQuota= @{n="ProhibitSendQuota"; e={if ( (Get-Mailbox $m).ProhibitSendQuota.Value) { (Get-Mailbox $m).ProhibitSendQuota.Value.ToMB() } else {"-"}}} $ProhibitSendReceiveQuota= @{n="ProhibitSendReceiveQuota"; e={if ( (Get-Mailbox $m).ProhibitSendReceiveQuota.Value) { (Get-Mailbox $m).ProhibitSendReceiveQuota.Value.ToMB() } else {"-"}}} $IssueWarningQuota= @{n="IssueWarningQuota"; e={if ( (Get-Mailbox $m).IssueWarningQuota.value) { (Get-Mailbox $m).IssueWarningQuota.value.ToMB() } else {"-"}}} $DBIssueWarningQuota= @{n="DBIssueWarningQuota"; e={if ( (Get-MailboxDatabase -Identity $m.Database).IssueWarningQuota.Value) { (Get-MailboxDatabase -Identity $m.Database).IssueWarningQuota.Value.ToMB() } else {"-"}}} $DBProhibitSendQuota= @{n="DBProhibitSendQuota"; e={if ( (Get-MailboxDatabase -Identity $m.Database).ProhibitSendQuota.Value) {(Get-MailboxDatabase -Identity $m.Database).ProhibitSendQuota.Value.ToMB()} else {"-"}}} $DBProhibitSendReceiveQuota=@{n="DBProhibitSendReceiveQuota"; e={if ( (Get-MailboxDatabase -Identity $m.Database).ProhibitSendReceiveQuota.Value) { (Get-MailboxDatabase -Identity $m.Database).ProhibitSendReceiveQuota.Value.ToMB()} else {"-"}}} get-mailbox -resultSize unlimited $m | ` select name,PrimarySmtpAddress,UseDatabaseQuotaDefaults, $TotalItemSize,` $ProhibitSendQuota,` $ProhibitSendReceiveQuota,` $IssueWarningQuota,` $DBIssueWarningQuota,` $DBProhibitSendQuota,` $DBProhibitSendReceiveQuota}
If you want to format as table below is the command with format table.
$u = Get-Mailbox foreach ($m in $u) { $TotalItemSize = @{n="TotalSize"; e={if ( (Get-MailboxStatistics -Identity $m).TotalItemSize.Value) { (Get-MailboxStatistics -Identity $m).TotalItemSize.Value.ToMB() } else {"-"}}} $ProhibitSendQuota = @{n="ProhibitSendQuota"; e={if ( (Get-Mailbox $m).ProhibitSendQuota.Value) { (Get-Mailbox $m).ProhibitSendQuota.Value.ToMB() } else {"-"}}} $ProhibitSendReceiveQuota = @{n="ProhibitSendReceiveQuota"; e={if ( (Get-Mailbox $m).ProhibitSendReceiveQuota.Value) { (Get-Mailbox $m).ProhibitSendReceiveQuota.Value.ToMB() } else {"-"}}} $IssueWarningQuota = @{n="IssueWarningQuota"; e={if ( (Get-Mailbox $m).IssueWarningQuota.value) { (Get-Mailbox $m).IssueWarningQuota.value.ToMB() } else {"-"}}} $DBIssueWarningQuota = @{n="DBIssueWarningQuota"; e={ if ( (Get-MailboxDatabase -Identity $m.Database).IssueWarningQuota.Value) { (Get-MailboxDatabase -Identity $m.Database).IssueWarningQuota.Value.ToMB() } else {"-"}}} $DBProhibitSendQuota = @{n="DBProhibitSendQuota"; e={if ( (Get-MailboxDatabase -Identity $m.Database).ProhibitSendQuota.Value) { (Get-MailboxDatabase -Identity $m.Database).ProhibitSendQuota.Value.ToMB() } else {"-"}}} $DBProhibitSendReceiveQuota = @{n="DBProhibitSendReceiveQuota"; e={if ( (Get-MailboxDatabase -Identity $m.Database).ProhibitSendReceiveQuota.Value) { (Get-MailboxDatabase -Identity $m.Database).ProhibitSendReceiveQuota.Value.ToMB() } else {"-"}}} get-mailbox -resultSize unlimited $m | ` select name,PrimarySmtpAddress,UseDatabaseQuotaDefaults, $TotalItemSize,` $ProhibitSendQuota,` $ProhibitSendReceiveQuota,` $IssueWarningQuota,` $DBIssueWarningQuota,` $DBProhibitSendQuota,` $DBProhibitSendReceiveQuota | format-table name,PrimarySmtpAddress,UseDatabaseQuotaDefaults,$TotalItemSize,$ProhibitSendQuota,$ProhibitSendReceiveQuota,$IssueWarningQuota,$DBIssueWarningQuota,$DBProhibitSendQuota,$DBProhibitSendReceiveQuota}