簡體   English   中英

在 posh-ssh 和 powershell 中使用 racadm

[英]Using racadm in posh-ssh and powershell

我正在運行 racadm 命令來查找 Posh-Ssh 模塊上的核心數,有人知道如何計算總數嗎?

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

給你這個 output: 8 8但我想要完整的金額。

還知道如何獲取 CPU 計數嗎? 似乎在文檔中看不到任何內容。

謝謝!

如果最終 output 中的數字被空格分隔,請嘗試以下操作:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM