Powershell - Select the values of one property on all objects of an array
- by Sylvain Reverdy
Sorry, I'm still a noob on Powershell and I could not find an answer on Internet...
Let's say we have an array of objects $objects.
Let's say these objects have a "Name" property.
This is what I want to do
$results = @()
$objects | %{ $results += $_.Name }
this works but can it be done on a better way?
If I do something like :
$results = objects | Select Name
$results is an array of objects having a Name property.
I want $results to contain an array of Names
So, is there a better way ?
Thx a lot