Show the size of mailboxes in MB

This is how to get the mailbox size for all users and convert it to MB, there’s no point in getting it in Bytes if you ask me.
Get-MailboxStatistics | ft DisplayName,@{label="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}}

And sorting it descending:
Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | ft DisplayName,@{label="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}}

And showing the number of items:
Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | ft DisplayName,@{label="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}},ItemCount

And if you only want the information for a specific mailbox:
Get-MailboxStatistics –Identity <MailboxDisplayName> | ft DisplayName,@{label="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}},ItemCount

But if you got a large number of users this really only makes sense if we export the output to a csv:
Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | Select DisplayName,@{name="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}},ItemCount | Export-CSV C:\Mailboxsize.csv

If you only want information from the mailboxes in a specific database:
Get-MailboxStatistics –Database <Name of Database> | Sort-Object TotalItemSize -Descending | Select DisplayName,@{name="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}},ItemCount

I will continue this theme in the next couple of days with information on retrieving mailbox database size…

Set Automate Processing for all room mailboxes

This command sets the Automate Processing to Autoaccept for all room mailboxes:
get-mailbox -RecipientTypeDetails roommailbox | Set-MailboxCalendarSettings -AutomateProcessing:Autoaccept

Show deleted mailboxes in “Disconnected Mailbox”

I noticed yesterday that I could not see a previously deleted mailbox in “Disconnected Mailbox” In EMC. After some digging it hit me that maybe it takes a while before the mailbox will show. Since I didn’t have time to wait I used the following command to find the mailbox:
Clean-MailboxDatabase  <DatabaseName>

This forces Exchange to scan the database for disconnected mailboxes. When the command was finished the mailbox showed up in EMC and I where able to restore it. Problem solved…

What if I want to use EMS to show the disconnected mailboxes? Then you use the following command:
Get-MailboxStatistics -Server <ServerName> | where { $_.DisconnectDate -ne $null } | select DisplayName,DisconnectDate,DatabaseName

And use this command to re-connect the mailbox:
Connect-mailbox –database <DatabaseName> –Identity <DisconnectedMailboxName> –User <ConnectToUser>

Find out the last full backup date for a database

I was going mad last night trying to find out the time for the Last Backup of a database. After a while I found out that I needed to add -status to my command or the backup properties where blank. Command as follows:
Get-MailboxDatabase -Status | fl Name,Server,*backup*
If you only want the LastFullBackup:
Get-MailboxDatabase -Status | fl Name,Server,LastFullBackup
And if you only want to list the databases where the backup didn’t go as planned today:
Get-MailboxDatabase -Status | Select Name,Server,LastFullBackup | Where { $_.LastFullBackup -le (get-date).adddays(-1) }

View number of mailboxes per database

This gives you a count of all mailboxes per database, useful for planning mailbox creation.
Get-Mailbox -ResultSize:Unlimited | Group-Object -Property:Database | Select-Object Name,Count | Sort-Object -Property:Count -Descending

Here is a filter example for showing only the users in a specific database:
Get-Mailbox -ResultSize:Unlimited | Group-Object -Property:Database | Select-Object Name,Count | Sort-Object -Property:Count -Descending | where {$_.Name -like "*<Part of Database Name>*"}

Create E-mail address policy based on group membership

To create a e-mail address policy based on a group membership use the following command:
New-EmailAddressPolicy "<Policyname>" -RecipientFilter {((MemberOfGroup -eq "<Distinguished Name of the group>"))} -EnabledPrimarySMTPAddressTemplate ‘<Address syntax>’
For example:
New-EmailAddressPolicy "Test – Sundis Users 3" -RecipientFilter {((MemberOfGroup -eq "CN=Sundis Users 3,OU=Groups,OU=Sundis,DC=sundis,DC=internal"))} -EnabledPrimarySMTPAddressTemplate ‘SMTP:%m@test.internal’

Exchange 2007, VMware, NLB, Cisco Catalyst and ARP

Recently I worked with a customer to implement a vmware based Exchange 2007 setup with two NLB-clustered CAS. We followed VMware’s recommendations regarding uni/multicast settings and choosed multicast for the NLB cluster ( We realised after some testing that we could not reach the cluster IP from outside the local server subnet where the NLB nodes where sitting.
After some digging we found that there is a couple of things to consider when using multicast and Cisco equipment. Im not an network specialist so Im not going to give you a complete description of the problem. But in short the Cisco devices do not accept an arp reply for a unicast IP address that contains a multicast MAC address. In multicast mode the virtual IP address therefore becomes unreachable when accessed from outside the local subnet. To solve the problem we followed this guide from Cisco: and enabled IGMP Multicast for the NLB cluster.