Site icon Franky's Web

Exchange 2019: Monitor the maximum size of the database

I had a previous articles have already reported on the 1TB limit for Exchange Server 2019 Standard Server. Exchange Server Standard Edition no longer mounts a database above a size of 1 TB. Unfortunately, this is often only noticed when it is too late.

If, for example, a database reaches the 1TB limit during normal operation, the problem is usually only noticed after the server has been restarted, because a mounted database is not simply terminated.

As described in the older article, the maximum size for databases can be adjusted in the registry. The article also contains a script that creates the necessary registry key.

The script must be executed on all Exchange servers, as otherwise problems may occur, particularly with a DAG. If the maximum size for the databases is only adjusted on the server with the active database copies, the passive server cannot mount the databases if the active server fails due to the size.
I have therefore created another script which retrieves the value "Database Size Limit in GB" and the current size for each database from each Exchange server. The values are then saved with the corresponding registry paths in a PowerShell object.

The script can be useful in larger environments with several databases and Exchange servers to monitor the corresponding values and configurations. If required, the read values can be further processed with PowerShell:

$MailboxDatabases = Get-MailboxDatabase -status | select name,guid,servers,DatabaseSize

$DatabaseMaxSizes = @()
foreach ($MailboxDatabase in $MailboxDatabases) {
	$MailboxDatabaseSize = $MailboxDatabase.databasesize.ToGB()
	
	foreach ($Server in $MailboxDatabase.Servers) {
	$RegPath = "HKLM:\SYSTEM\CurrentControlSet\Services\MSExchangeIS\"
	$DatabaseRegPath = "HKLM:\SYSTEM\CurrentControlSet\Services\MSExchangeIS\" + $Server.Name + "\Private-" + $MailboxDatabase.Guid
	if ($env:computername -match $Server.Name) {
			$DBSizeRegKey = Get-ItemProperty -Path: $DatabaseRegPath -Name "Database Size Limit in GB"
	}
	else {

			$DBSizeRegKey = Invoke-Command -Computer $Server.Name -ScriptBlock {Get-ItemProperty -Path: $Using:DatabaseRegPath -Name "Database Size Limit in GB"}
	}
	
	if ($DBSizeRegKey) {
		$RegDatabaseSize = $DBSizeRegKey. "Database Size Limit in GB"
	}
	else {
		$RegDatabaseSize = 1024
	}
	$DatabaseMaxSizes += @(
		[pscustomobject]@{
			ServerName = $Server.Name
			MailboxDatabaseName= $MailboxDatabase.Name
			RegistryMaxSizeInGB=$RegDatabaseSize;
			CurrentDatabaseSizeInGB = $MailboxDatabaseSize
			DatabaseGUID = $MailboxDatabase.Guid
			DatabaseRegPath = $DatabaseRegPath
			}
		)
	}
}
$DatabaseMaxSizes

The following example provides all servers and databases for which the limit has not been set to 10240 GB:

$DatabaseMaxSizes | where {$_.RegistryMaxSizeInGB -ne 10240} | ft

This example shows all the data volumes that are currently over 5000 GB in size:

$DatabaseMaxSizes | where {$_.CurrentDatabaseSizeInGB -gt 5000} | ft

If required, the information can also be easily exported:

$DatabaseMaxSizes | Export-Csv D:\Export\db.csv -NoTypeInformation

If the script does not find the corresponding registry entries, it assumes the default value of 1TB (even if it runs into an error). If the limit is to be increased, the registry keys must be created:

Here is my new favorite quote (from the linked article):

Exit mobile version