skip to Main Content

Pagefile Exchange 2019 best practice PowerShell

How to configure the pagefile in Exchange Server 2019 through PowerShell? You can configure the pagefile in two ways. One of them is through Exchange Server GUI. The other way is with PowerShell. If you do it through the GUI, you need to do the math first. After that, you need to edit the pagefile. What if you don’t want to do the math and don’t like to edit the pagefile through the Exchange Server GUI? For example, you want it to run on many Exchange Servers. Editing every Exchange Server through the GUI will take time. What if you can run a script that will do it all? PowerShell to the rescue.

Before you start

If you want to learn more and set the pagefile on an Exchange Server 2013/2016, read the following articles:

Pagefile information

The pagefile sizing changed in Exchange Server 2019 compared to Exchange Server 2013/2016.

Exchange 2019
Pagefile sizing is now 25% of total RAM (maximum of 64GB). The maximum memory is 256GB.

Exchange 2016
Pagefile sizing is RAM + 10MB (maximum of 32GB RAM + 10MB). The maximum memory is 192GB.

Exchange 2019 pagefile examples

If you want to configure your Exchange Server 2019 pagefile. Here are some examples:


Microsoft recommends 128GB RAM for the Mailbox Role and 6GB RAM for the Edge Transport Role.

Configure Exchange Server pagefile through PowerShell

I came across the following post by Damian Scoles. He made a script to configure the pagefile of the Exchange Server 2019. Download the Set-PagefileExchange2019.ps1 PowerShell script. Save the script in your c:\scripts\ folder. Run the PowerShell script as administrator. If you like, you can copy the script below and paste it in PowerShell. The script will remove the old pagefile and configure a new pagefile with the correct size.

Set-CimInstance -Query "Select * from win32_computersystem" -Property @{automaticmanagedpagefile = "False" }
$RamInMb = (Get-CIMInstance -computername $name -Classname win32_physicalmemory -ErrorAction Stop | measure-object -property capacity -sum).sum / 1MB
$ExchangeRAM = $RAMinMb * 0.25
Set-CimInstance -Query "Select * from win32_PageFileSetting" -Property @{InitialSize = $ExchangeRAM; MaximumSize = $ExchangeRAM }

It’s a great script and does the job. If you have many Exchange Servers and want to change the pagefile, make your life easier, and run the script. Will you be using the PowerShell script in your Exchange Server 2019? I recommend using the script.

Keep reading: Install Exchange Server 2016 step by step with GUI »


You learned how to change the Exchange Server 2019 pagefile through PowerShell. Run the script, and it will configure the pagefile on the Exchange Server 2019. Don’t forget to reboot after the change! This script should only run in Exchange Server 2019. Not on other Exchange Server versions.

Did you enjoy this article? You may also like Certificate warning during or after a new Exchange Server installation. Don’t forget to follow us and share this article.



ALI TAJRAN is a passionate IT Architect, IT Consultant, and Microsoft Certified Trainer. He started Information Technology at a very young age, and his goal is to teach and inspire others. Read more »

This Post Has 0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *