作为输出之一的一部分,我得到了以下对象类型。
System.Collections.ObjectModel.Collection`1 [System.Management.Automation.PSObject]
我尝试了以下操作,但是,它没有打印任何内容。
$out=$ScriptBlock.Invoke()
Write-Host "type == " $out.GetType()
$out[0].Properties | ForEach-Object {
$_.Name
$_.Value
}
答案 0 :(得分:0)
$out[0]
可能没有.Properties
成员,或者它不是数组。
尝试让PowerShell描述您所拥有的内容:
# see what's in this
PS> $out
# if it's an actual array
PS> $out[0] | Get-Member