Manage Exchange 2010 Database Log Growth by Using the Troubleshoot-DatabaseSpace.ps1 Script in the Shell

The Troubleshoot-DatabaseSpace.ps1 script is used by Microsoft System Center Operations Manager 2007 to detect and correct any excess log growth or Microsoft Exchange database (.edb) file growth that, if unchecked, may cause database downtime. By default, System Center Operations Manager 2007 runs the script every 15 minutes. However, you can use Task Scheduler to configure and run this script to monitor database log and file growth.

The Troubleshoot-DatabaseSpace.ps1 script performs the following actions:

  1. Keeps track of log generation rate for the highest log generators per database. This helps determine which users are logging too heavily and potentially causing space issues.
  2. Keeps track of the available disk space for both the database and the log files. If either of these is within a configurable threshold of being full, further action must be taken.
  3. Keeps track of the log generation rate. If it appears that the disk is going to run out of space within the value specified by the HourThreshold parameter (based on the log generation rate), further action must be taken.


    To avoid critical issues, make sure the value for the HourThreshold parameter is large enough to give you time to react during normal business hours while enough free space is available. If drives are filling up faster than the value specified, immediate action must be taken to protect the disk.

  4. If all of the preceding conditions are fulfilled, the script determines the list of top 25 users who accessed the database during the last one-hour period. The script then quarantines the top high-usage mailboxes for which the sum of the log generation rate is greater than the difference between the current generation rate and the sustainable generation rate that would allow tiding over the configurable time threshold. These users are quarantined for six hours, during which they won’t have access to e-mail.
  5. If the troubleshooter is unsuccessful at dropping the log generation rate to below the threshold level, it will write out events that translate into health model alerts. At this point, the script removes the database from provisioning by running the Set-MailboxDatabase cmdlet with the ExcludeFromProvisioning parameter set to $true against the specified database. You may need to move mailboxes to a new server to rebalance space.
  6. If the troubleshooter quarantines more than 10 users, this indicates a systemic issue, which you need to follow up on. The health model will trigger an urgent alert from this condition.

The default settings used in the Troubleshoot-DatabaseSpace.ps1 script are defined in the StoreTSConstants.ps1 script.

Command: .\Troubleshoot-databasespace.ps1 -server MBX01 -PercentLogFreeSpace 10 -PercentEDBFreeSpace 10 -HourThreshold 5 -Quarantine

Taskscheduler: powershell.exe -PSConsoleFile “C:\Program Files\Microsoft\Exchange Server\V14\bin\exshell.psc1” -command “. ‘C:\Program Files\Microsoft\Exchange Server\V14\Scripts\Troubleshoot-databasespace.ps1’ –server EX01 -PercentLogFreeSpace 10 -PercentEDBFreeSpace 10 -HourThreshold 1 -Quarantine”

Translate »