Sunday, March 04, 2012

Exchange 2003 Powershell - Mailbox size

Really good script:

#      Author:  Steven Peck   - #">www.blkmtn.org

#        Date:  06/15/2007
# Description:  Exchange 2003 output to file
#        Display Name, Store, Storage group, MB Size, and Date Absent in DS
# Changed by Boris Sirotin 3/4/2012 to include external parameters for possible 3 exchange servers
#The syntax will be: .\thescriptname server01 server02 server03
# Get date for file name
param ($server01,$server02,$server03)
$day = Get-Date -UFormat "%Y%m%d"
# Gets data through WMI from specified Exchange mailbox servers
$computers = $server01, $server02, $server03
#
foreach ($computer in $computers) {
Get-Wmiobject -namespace root\MicrosoftExchangeV2 -class Exchange_Mailbox -computer $server01 | sort-object -desc MailboxDisplayName `
   | select-object MailboxDisplayName,StorageGroupName,StoreName,Size,DateDiscoveredAbsentInDS | Export-Csv -Path c:\temp\$computer-$day.csv
}

No comments:

Post a Comment