RuiRomano / pbigtwmonitor

MIT License
84 stars 29 forks source link

CPU core count seems not to work on a multi socket machine #2

Open NOF42 opened 2 years ago

NOF42 commented 2 years ago

Hi Rui, i am enjoying your package :-). However, i realized that the core count procedure seems not to work on a multi socket machine. In that case the result is a table - and the later it will fail in the PowerBI template because of an type mismatch (the values come in with a string instead of a number). It is about this line in your code: $serverCPU = (Get-ComputerInfo -Property CsProcessors).CsProcessors

I fixed with providing the computer name and looping through the table while aggregating the number: $serverCPU = (Invoke-command -ComputerName "XXXX-DGW01" -ScriptBlock {Get-ComputerInfo -Property CsProcessors}).CsProcessors $gatewayProperties.NumberOfCores = 0 foreach ($Socket in $serverCPU) { $gatewayProperties.NumberOfCores += $Socket.NumberOfLogicalProcessors }

You might have a nicer way to do it (i am not that much a PowerShell code junky...).

Thanks a lot for taking care about this :-).

BR/Norbert Feistl