我使用以下脚本:
get-wmiobject -class win32_physicalmemory | select Name, Model, Speed, Capacity, DeviceLocator
并且输出列出了4块内存,但我想要做的是计算物理内存的数量,然后列出模型,速度,容量和设备定位器。
我尝试过使用:
(get-wmiobject -class win32_physicalmemory | select Name, Model, Speed, Capacity, DeviceLocator).count
但这只会返回4,而不是4 和其他属性。
答案 0 :(得分:1)
您总是可以分两部分来完成:
$mem = get-wmiobject -class win32_physicalmemory | select Name, Model, Speed, Capacity, DeviceLocator
"Count is $($mem.count)"
$mem