Execution Flow
Delegates the actual sp_configure call to
Set-DbaMaxMemory. The change takes effect immediately without a SQL Server restart. Use Test-sqmMaxMemory to audit current settings without changing them. -RecommendedPct is validated between 70–99.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| -SqlInstance | String | Optional | Target SQL instance. Default: $env:COMPUTERNAME. |
| -SqlCredential | PSCredential | Optional | SQL authentication credential. |
| -RecommendedPct | Int | Optional | Percentage of physical RAM to assign (70–99). Default: 90. Ignored when -MaxMemoryMB is given. |
| -MaxMemoryMB | Int | Optional | Explicit value in MB (≥ 512). Overrides -RecommendedPct. |
| -EnableException | Switch | Optional | Throws terminating errors instead of returning a failed result. |
| -WhatIf / -Confirm | Switch | Optional | Standard ShouldProcess support. |
Return Value
Returns a PSCustomObject with: SqlInstance, PreviousMaxMemMB, NewMaxMemMB, TotalRamMB, Status, Message.
Examples
Example 1 — Set to 90% of physical RAM
Set-sqmMaxMemory -SqlInstance "SQL01"
Example 2 — Explicit value (24 GB)
Set-sqmMaxMemory -SqlInstance "SQL01" -MaxMemoryMB 24576
Example 3 — Preview 80% setting
Set-sqmMaxMemory -SqlInstance "SQL01" -RecommendedPct 80 -WhatIf