1

Lets say I have an object named something:

Name                                           : name1
Group                                          : group1

Name                                           : name2
Group                                          : group2

Name                                           : name3
Group                                          : group1

I can access all names by:

$something | Select -ExpandProperty "Name";

it returns: name1 name2 name3

How would I select only the names from group1? so it returns

name1 name3

Something like:

$something | Select -ExpandProperty "Name" -Where [Group -eq 'group1'];

1 Answer 1

4

Use the Where-Object cmdlet to filter:

$something |Where-Object Group -eq 'group1' |Select -ExpandProperty "Name"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.