Where I work we have been gradually scaling mailbox sizes back to workable levels. Before each limit change, my manager always wants to know who it is going to affect ahead of time. If you just have one mailbox store, this is an easy task. I have 5 Storage groups and anywhere between 3 and 5 mailstores in each storage group, so it can take me some time for me to go through each mailstore and manually jot down everything. So I decided to dive into a little scripting.
This script will list out the name of the user, mailstore name, total size and total items for each user above the limit. I have added two(2) numbers in here. One is the "Over the mailbox limit" and the other is "Over the warning limit. These numbers are in Kilobytes.
The only other field you will have to change is the strComputer; which must be the mailserver name.
———-COPY EVERYTHING BELOW THIS LINE———-
'On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile( _
"C:\EMB_Size.txt")
strComputer = "MailServerName"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & _
"\ROOT\MicrosoftExchangeV2")
Set colItems = objWMIService.ExecQuery _
("Select * from Exchange_Mailbox")
For Each objItem in colItems
If objItem.Size > 1048576 Then
objTextFile.WriteLine " "
objTextFile.WriteLine "!!!!!!!!!!OVER LIMIT!!!!!!!!!! "
objTextFile.WriteLine " "
objTextFile.WriteLine "User Name: " & objItem.MailboxDisplayName
objTextFile.WriteLine "Store name: " & objItem.StoreName
objTextFile.WriteLine "Total items: " & objItem.TotalItems
objTextFile.WriteLine "Size: " & objItem.Size
objTextFile.WriteLine " "
objTextFile.WriteLine "——————————————"
Else
End If
Next
For Each objItem in colItems
If objItem.Size > 943718 Then
objTextFile.WriteLine " "
objTextFile.WriteLine "!!!!WARNING!!!!"
objTextFile.WriteLine " "
objTextFile.WriteLine "User Name: " & objItem.MailboxDisplayName
objTextFile.WriteLine "Store name: " & objItem.StoreName
objTextFile.WriteLine "Total items: " & objItem.TotalItems
objTextFile.WriteLine "Size: " & objItem.Size
objTextFile.WriteLine " "
objTextFile.WriteLine "——————————————"
End if
Next
———-COPY EVERYTHING ABOVE THIS LINE———-
This script is provided "AS IS" with no warranties expressed or implied.