By collecting the user objects based on their organizational unit container with the first cmdlet, we are
able to modify the fax number on all users in bulk with the second cmdlet without additional complex
programming.
Filtering Objects
Not all cmdlets may provide parameters for filtering objects like the one shown in the previous example.
And though some cmdlets may provide a few filtering parameters, they may not provide a parameter
for the specific property you may need to use as a filter condition. That ??™ s when you need to become
familiar with the Where-Object filter cmdlet.
Where-Object allows you to filter objects out of the command stream based on one or more test
conditions you specify in a script block. The test conditions are based on one or more of the objects ??™
properties. Only the objects that meet the test conditions are passed on to the next command, while all
others are discarded. The most basic syntax of Where-Object is easy to learn:
< command > | Where-Object { < test condition > } | < command >
Where and ??????? are both shorthand alias names for the Where-Object cmdlet.
The test condition is an expression that resolves to either Boolean true or false. Only the objects that
resolve true when tested are passed down the pipeline to the next command.
Pages:
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61