Introduction to Exchange Server Database Limits

When managing an Exchange Server, it’s crucial to keep an eye on the database limits. By default, the limits are set to 1TB on Exchange Server Standard Edition.

Using PowerShell to Modify Database Limits

PowerShell makes it easier to make bulk changes to all servers, especially if you are managing several servers and mailbox databases in Exchange. To increase the limits, you’ll be adjusting the settings in the registry. The registry change is manual, whereas the PowerShell script below can be run against every Exchange Server or the ones you select to make the changes on.

The PowerShell script has parameter values you can modify, for example, I set my lab to 5000, feel free to change it the value that works for you.

<#

.SYNOPSIS

  Sets “Database Size Limit in GB” to 5000 on all Exchange 2019 mailbox databases

  (or on selected servers).

.PARAMETER AllServers

  Apply change to all Exchange Mailbox servers.

.PARAMETER Servers

  Apply only to this list of servers.

.PARAMETER Value

  Decimal value to write. Default = 5000.

.PARAMETER WhatIf

  Preview changes without modifying registry.

.EXAMPLE

  .\Set-ISDatabaseSizeLimit.ps1 -AllServers

.EXAMPLE

  .\Set-ISDatabaseSizeLimit.ps1 -Servers EXCH01,EXCH02

#>

[CmdletBinding(SupportsShouldProcess=$true)]

param(

    [switch] $AllServers,

    [string[]] $Servers,

    [int] $Value = 5000,

    [pscredential] $Credential

)

begin {

    if (-not $AllServers -and -not $Servers) {

        throw “You must specify either -AllServers or -Servers <name>.”

    }

    if ($AllServers) {

        try {

            $Servers = (Get-MailboxServer -ErrorAction Stop).Name

        }

        catch {

            throw “Unable to query Exchange mailbox servers: $($_.Exception.Message)”

        }

    }

}

process {

    $scriptBlock = {

        param($Value)

        $pathBase = “HKLM:\SYSTEM\CurrentControlSet\Services\MSExchangeIS\$env:COMPUTERNAME”

        $valueName = “Database Size Limit in GB”

        $results = New-Object System.Collections.Generic.List[object]

        if (-not (Test-Path $pathBase)) { return $results }

        $keys = Get-ChildItem $pathBase | Where-Object { $_.PSChildName -like “Private-*” }

        foreach ($k in $keys) {

            # Backup original value

            $existing = $null

            try {

                $existing = Get-ItemPropertyValue -LiteralPath $k.PSPath -Name $valueName -ErrorAction Stop

            }

            catch {}

            # Write new value

            try {

                Set-ItemProperty -LiteralPath $k.PSPath -Name $valueName -Value $Value -Type DWord -Force

                $status = “Updated”

            }

            catch {

                $status = “FAILED: $($_.Exception.Message)”

            }

            $results.Add([pscustomobject]@{

                Server       = $env:COMPUTERNAME

                RegistryPath = $k.PSPath

                OldValue     = $existing

                NewValue     = $Value

                Status       = $status

            })

        }

        return $results

    }

    $invokeParams = @{

        ComputerName = $Servers

        ScriptBlock  = $scriptBlock

        ArgumentList = @($Value)

        ErrorAction  = “Stop”

    }

    if ($Credential) {

        $invokeParams.Credential = $Credential

    }

    Write-Host “`nUpdating Database Size Limit to $Value GB…” -ForegroundColor Cyan

    $output = Invoke-Command @invokeParams

    $output | Format-Table -AutoSize

    return $output

}

end {}

Discover more from COLLABORATION PRO

Subscribe now to keep reading and get access to the full archive.

Continue reading