Get MaxServerMemory from Get-SqlInstance


Thanks for your time in reading my question. Appreciate it :slight_smile:
Q: In process of gathering data from various SQL instances to our Central collection server. Using SqlServer module to accomplish the task. However when tried to pull SQL Instance Configuration values using Get-SqlInstance resulted in blank for Max Memory value

Get-SqlInstance -ServerInstance TestServer | Select-Object @{n='CollectionDate';e={Get-Date -format d}} ,@{n='SqlInstance';e={$_.Name}} `
,ClusterName ,Collation `
,Edition ,HostPlatform `
,VersionString ,IsClustered `
,IsHadrEnabled ,NetName `
,InstanceName ,ServiceAccount `
,@{n='MaxMemoryInMB'; e={$_.Configuration.MaxServerMemory}} `

if I save the server object to variable and use $var.Configuration.MaxServerMemory gives me output. How to achieve this in pipeline ?

Found the issue. Missed actual property name (ConfigValue) to specify in the expression. I get the value now


– PS: Mark as Answered