我想向对象数组添加一个新属性。添加会员不起作用,请协助
$computers = Get-ADComputer -Filter {(name -like "SMZ-*-DB")} | select -First 30
workflow test-test
{
param([Parameter(mandatory=$true)][string[]]$computers)
$out = @()
foreach -parallel -throttlelimit 20 ($computer in $computers)
{
sequence
{
[bool]$ping = (Test-Connection $computer.name -Quiet -Count 1)
$computer = $computer | Add-Member -NotePropertyName "Ping" -NotePropertyValue $ping
$Workflow:out += $computer
}
}
return $out
}
test-test $computers