Export List of Exchange 2007 mailbox sizes – Powershell script


I have this script set as a sceduled task and runs daily on my companies Exchange 2007 servers. It helps to see not only the current sizes but to see if any mailboxes are getting out of control.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
##############################################################
# Creates a file with all exchange 2007 mailboxes and sort by size
#
#
#
# Command, scheduled task or shortct (all one line of course)
# C:\WINDOWS\system32\WindowsPowerShell\v1.0\PowerShell.exe -PSConsoleFile
#"C:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1" -noexit -command ".
#'C:\Scripts\Mailbox Size.ps1'"
##############################################################

# sets date variable and desired format
$date= Get-Date -Uformat "%d-%m-%y"

# Creates file using the date
date > C:\Exports\Mailbox_Size\MailBox_Size_$date.txt

# Gets and sorts mailboxes by size then exports to file created above
##     this should all be on one line
Get-MailboxStatistics | Sort-Object -property TotalItemSize | Format-Table DisplayName,TotalItemSize >> C:\Exports\Mailbox_Size\MailBox_Size_$date.txt

 

Exit
#################################################################



You can leave a response, or trackback from your own site.


Further Reading
    None Found




Leave a Reply

Anti-Spam Quiz:

Twitter Delicious Facebook Digg Stumbleupon Favorites More
334 queries in 2.698 seconds.