This script will get the EDB size and the actual Log size for each of your databases in your infrastructure.

It received a couple of parameters:


Will it bring any additional information?

Yes, it will also bring the file path (from EDB file and log files) for each database. Furthermore, it will bring the circular logging info if it's enabled or not for each database.


What's new in version 3?

  1. Clearer logic to commit its goal.
  2. Contains the "Get-help" required to use it like: Get-Help .\Get-EDBnLogsSize -full
  3. Aligned to PS standard.
  4. More Documentation.
  5. Since this version on, the script will be called Get-EDBnLogsSize, the previous name was ExchangeEDBnlogsize.ps1, this was changed to align the script into the Powershell Standards.


New Version 5?

 Yes, with this version we have more options. The script accepts the number of decimals that you want to have for the audit log size and one switch parameter "FT"; This is a switch value that will tell if the output of the script should be an object to further use in a script (when you do the call without specifying this switch or with value $false), or return the parameter to print it on the screen. The default parameter output is the output as an object.


Great, so how do I use it?

Option 1:  Get Sizes from EDB and LogFiles in Gb (with 5-digit precision) and object output




(Btw look at the EdbSizeinGB and the LogSizeinGB, They are in the same scale, and it's enabled CircularLogging because the CircularLoggingEnabled is True on both).

Default parameters are: Decimals =5 digits (just in LogSizeGb, EDbSize is calculated from the exchange server), (-ft:$false, so the output is a PS object)

Option 2:  Get Sizes from EDB and LogFiles in Gb (with 5-digit precision) and output for printing on screen

.\Get-EDBnLogSize.ps1 -ft

Option 3:  Get Sizes from EDB and LogFiles in Gb (with 10-digit precision) and output an object


.\Get-EDBnLogSize.ps1 -Decimals 10



Option 4:  Get Sizes from EDB and LogFiles in Gb (with 8-digit precision) and output for printing


.\Get-EDBnLogSize.ps1 -Decimals 8 -ft



Note1: The difference between "output for printing" and "output as object" is the use you will give to the output. The output for printing uses the "format-table" or "ft" parameter this is basically to show into the screen with no further other use than "print on the screen." If you want to use this script as a base of your script or just want to have the nice object format in the query you just don't use the -ft parameter.

Note2: the number of digits in decimals is arbitrary, this means that you can decide how many decimals you have uses the Math.round class to do it, so the limitation is listed in the C# class in here


What's the name of the script, Get-EDBnLogSize.ps1 (Standarized)?

Find out the Exchange Database and Log Sizes and the local path where the files live.


What's this script about?

Initially, can tell you where are located the databases and logs locally on the server. It can give you the size of every single database inside the server and give you the sizes in GB and can do the same with the logs. Also, can help you to solve this question:


When should I do a Backup to clean the Exchange server Logs of the servers?


I recommend that you run a backup in ALL the DRIVES where you have "DATABASES" and "LOGS."

They are the usually different location inside the same root. I'd recommend making a backup when your log's size will be nearby of the 30% of the size of the database that corresponds to that logs.



Database: 30Gb    Logs: 9Gb or more  (in this scenario I'll do the backup to clear that space on drives)


How do I use the script?

On exchange server:


In this example the server needs to be run for a backup, The sizes of the Logs are greater than the Database size (EdbSizeGB) 


This is the difference when you do run a backup to clear logs and when you don't, here's another couple of outputs:


Total EdbSizeGB (Databases in GB) 1st run: 188.78197 Gb and the LogsizeGB total :154.12235 Gb

Total EdbSizeGB (Databases in GB) 2nd run: 188.90697 Gb and the LogsizeGB total :1.99514 Gb

From this, this is a production environment:
The databases size increases in 0.125 Gb (128MB) but the sizes of the logs have been decreased in 152.12721 Gb  (awesome 98.71 %)