Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
NOF42 opened this issue Aug 30, 2022 · 0 comments
Open

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

NOF42 opened this issue Aug 30, 2022 · 0 comments

Comments

@NOF42
Copy link

NOF42 commented Aug 30, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant