Here is the code to find the EDB & STM file size of Exchange 2003 server with Powershell.
This works when EDB and STM file are in same folder.
$server = “ATS-Exch301″ # Give Server Name Here
foreach ($DB in get-mailboxdatabase -server $server)
{
$DBEDBPath = “name=’” + $DB.EdbFilePath.ToString().Replace(“\”,”\\”) + “‘”
$DBSTMPath = $DBEDBPath.replace(“edb”,”stm”)
$DBEDBSize = (get-wmiobject CIM_Datafile -filter $DBEDBPath -ComputerName $Server).filesize
$DBSTMSize = (get-wmiobject CIM_Datafile -filter $DBSTMPath -ComputerName $Server).filesize
$DBEDBSize = $DBEDBSize / 1MB
$DBSTMSize = $DBSTMSize / 1MB
Write-host $DB.identity `t $DBEDBSize `t $DBSTMSize
}




Kewl script buddy. made one hack to get the actual paths from the AD
$DBdn = $DB.DistinguishedName
$ADobj = New-Object DirectoryServices.DirectoryEntry “LDAP://$DBdn” | select *
$DBedbPath = “name=’” + $ADobj.msExchEDBFile.ToString().Replace(“\”,”\\”) + “‘”
$DBstmPath = “name=’” + $ADobj.msExchSLVFile.ToString().Replace(“\”,”\\”) + “‘”
Comment by Paul Flaherty — May 29, 2008 @ 10:19 am