dbatools is a free PowerShell module with over 300 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


This command retrieves the SQL Server ‘Max Server Memory’ configuration setting as well as the total physical installed on the server.



To get memory settings for all servers within the SQL Server Central Management Server “sqlcluster”.

Get-DbaMaxMemory -SqlServer sqlcluster,sqlserver2012

To find all servers in Server Central Management Server that have ‘Max Server Memory’ set to higher than the total memory of the server (think 2147483647)

Get-DbaMaxMemory -SqlServer sqlcluster | Where-Object { $_.SqlMaxMB -gt $_.TotalMB }


From PowerShell, execute Get-Help Get-DbaMaxMemory -Detailed for more information on this function.

Source Code

Want to see the source code? View Get-DbaMaxMemory.ps1 on GitHub

Related commands