Search code examples
powershellposh-ssh

Using racadm in posh-ssh and powershell


I'm running a racadm command to find the number of Core count on the Posh-Ssh module, would anyone know how to count the total amount?

$get_CoreInfo = Invoke-SSHCommand -Index 0 -command "racadm get BIOS.ProcSettings" 
Core_Number = ($get_CoreInfo.Output -match '(.*)NumCores=' -replace '(.*)NumCores=' )

gives you this output: 8 8 but I would like the complete amount.

Also any idea how to get the CPU Count? Can't seem to see anything in the documentation.

Thanks!


Solution

  • If the numbers in your final output are split by a white space, then try this:

    $get_CoreInfo = Invoke-SSHCommand -Index 0 -command "racadm get BIOS.ProcSettings" 
    $core_number_string = ($get_CoreInfo.Output -match '(.*)NumCores=' -replace '(.*)NumCores=')
    $core_number = 0
    foreach($cpu in ($core_number_string -split " ")){[int]$core_number += [int]$cpu}