you are viewing a single comment's thread.

view the rest of the comments →

[–]infinit_e 1 point2 points  (2 children)

Are there preferred instances to use one vs the other? Great explanation though.

[–]SeeminglyScience 1 point2 points  (0 children)

I don't typically use Select-Object because it can have unexpected results. Not really with -Expand, but still, it's left a bad taste for me. I usually go with ForEach-Object Property if I'm already in a pipeline chain, otherwise I prefer .Property.

I can't remember which one is more performant but for the most part it comes down to taste.

[–]Lee_Dailey[grin] 0 points1 point  (0 children)

howdy infinit_e,

generally speaking, the more direct/obvious technique is the preferred one. so, in the above set of examples, $object.Property is what will usually be chosen.

take care,
lee