【问题标题】:Using racadm in posh-ssh and powershell在 posh-ssh 和 powershell 中使用 racadm
【发布时间】:2020-04-09 22:05:00
【问题描述】:

我正在运行 racadm 命令来查找 Posh-Ssh 模块上的核心数,有人知道如何计算总数吗?

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

给你这个输出:8 8 但我想要完整的数量。

还知道如何获取 CPU 计数吗?似乎在文档中看不到任何内容。

谢谢!

【问题讨论】:

    标签: powershell posh-ssh


    【解决方案1】:

    如果最终输出中的数字被空格分隔,请尝试以下操作:

    $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}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-17
      • 2015-11-23
      • 1970-01-01
      • 2018-08-23
      • 1970-01-01
      相关资源
      最近更新 更多