Details
Description
Basic Info
Module Version: 1.9.3
Puppet Version: 5.5.19
OS Name/Version: All
When you use any of the new 5th generation servers in AWS (R5, C5 etc) you receive an error when attempting to configure the memory allocation on SQL Server dynamically
Desired Behavior: The memory is calculated and applied, based on what is available
Actual Behavior: You get an error and the puppet run fails, without changing anything
The error message you receive is as follows:
Error: Could not set 'present' on ensure: PowerShell DSC resource MSFT_SqlServerMemory failed to execute Set-TargetResource functionality with error message: Failed to alter the server configuration memory for SERVERNAME\MSSQLSERVER. InnerException: Exception calling "Alter" with "0" argument(s): "Alter failed for Server 'SERVERNAME'.
|
I believe that this issue has already been fixed by the DSC team in https://github.com/dsccommunity/SqlServerDsc/issues/914 (related to Azure, however I have tested the fix and it's valid in AWS too) so the simplest fix may be to release a new version of the module that has been rebased against the latest modules upstream.
For reference, the actual fix is the change of retrieving the data from Win32_PhysicalMemory to Win32_OperatingSystem shown below
## Original statement
|
$physicalMemory = ((Get-CimInstance -ClassName Win32_PhysicalMemory).Capacity | Measure-Object -Sum).Sum
|
|
## Fixed statement
|
$physicalMemory = ((Get-CimInstance -ClassName win32_ComputerSystem).TotalPhysicalMemory | Measure-Object -Sum).Sum
|