Exchange Server Share

… Information sharing on Exchange Server …

Powershell – Exchange 2003 EDB & STM File Size

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

}

Written by Amit Tank

May 19, 2008 at 3:52 am

One Response

Subscribe to comments with RSS.

  1. 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(“\”,”\\”) + “‘”

    Paul Flaherty

    May 29, 2008 at 10:19 am


Comments are closed.

%d bloggers like this: