Tip: Reducing Exchange 2013 storage space consumption

Hi Folks,

maybe you already run into the situation where you notice that Microsoft Exchange 2013 consume a lot of your HDD/Storage capacity?

This is mostly related to regular log files and transaction logs for the mail database but there are some ways to gain free space again and to clean it up a little bit.

First of all there is a really cool script to delete all the old regular log files, i found some time ago in an other blog (sorry i did not found the blog to name it as source, if the author read this please contact me to give you the credit!)

Set-Executionpolicy RemoteSigned

$days=7 #You can change the number of days here


$ExchangeLoggingPath=”C:\Program Files\Microsoft\Exchange Server\V15\Logging\”

Write-Host “Removing IIS and Exchange logs; keeping last” $days “days”

Function CleanLogfiles($TargetFolder)


if (Test-Path $TargetFolder) {

$Now = Get-Date

$LastWrite = $Now.AddDays(-$days)

$Files = Get-ChildItem $TargetFolder -Include *.* -Recurse | Where {$_.LastWriteTime -le “$LastWrite”}

foreach ($File in $Files)

{Write-Host “Deleting file $File” -ForegroundColor “Red”; Remove-Item $File -ErrorAction SilentlyContinue | out-null}


Else {

Write-Host “The folder $TargetFolder doesn’t exist! Check the folder path!” -ForegroundColor “red”





Copy the code and create a new cleanup.ps1 txt file and insert it, than execute the script thru Powershell (in Admin mode) and that’s it. The only modification done by myself is the day variable, thru this variable you can modify how old logs must be you want to delete. In this sample i delete all log files older than 7 days.

The second big storage killer are the mail database transaction logs.. There are two ways to handle it.

1) Use Windows Server Backup (Feature Role in Windows Server) and create a backup by following this article Exchange Backup. You can exclude all not needed folders like the Windows folder and so on. This scenario is mostly recommended for medium or large environments and is the save way to deal with transaction logs. Once the backup is done the transaction logs will be removed from the mail database folder and this can free a lot of space.

2) For smaller environments you can also use an other way, this way is less secure regarding the fact that this can result in a (small) dataloss. If you open the Exchange Management Console (ECP) browse to Server->Mail Database settings and edit the mail database settings (see picture below).



In the maintenance configuration enable circular logging, this will only create a few transaction log files that will merged into the database. Disadvantage: This way will consume some performance during the regular run/use time for the log file handling/merge. If the server crash it might be that the you loose some informations which are not merged into the database. Typical situation where i use this are smaller SMB Exchange scenarions running in a virtual Environment where the Mail Server VM is “secured” in any other way, Test and Demo environments  and environments where the User amount/Mail transfer is not on a very high level. I mention this because it was a default enabled feature for older Exchange versions and sometimes Administrators run into a storage trap after they upgrade there environment and be not aware about this changed default behavior.

Have Fun


P.S.: Everything on your own risk like everytime… 🙂