Commands can be constructed using
multiple pipelines to accomplish tasks too complex for a single cmdlet to accomplish alone.
Some cmdlets that use the Get verb provide a way to limit the collection of objects based on a parameter
value that acts as a filter. The resulting collection can then be passed by pipeline to a cmdlet that uses the
Set verb to modify one or more properties on each object. For example, the Get-User cmdlet includes
the OrganizationalUnit parameter.
Say your organization has implemented Organizational Units as a way to contain all users located in
the same geographical office. A need arises to change the fax number attribute for all user accounts in the
same office. Using the Get-User cmdlet with the appropriate value for the OrganizationalUnit
parameter you can create a collection of user objects limited to the users in the office. By passing this
Part I: PowerShell for Exchange Fundamentals
24
collection to the Set-User cmdlet along with the appropriate value for the Fax parameter you can
change the fax number quickly and easily on every user account using a single command line.
Commands that use multiple cmdlets and pipelines on a single line are often referred to as ??? one - liners. ???
The following one - line command demonstrates the previous example for changing the fax number for
all users contained in the ??? Denver ??? organizational unit:
[PS] C:\ > Get-User -OrganizationalUnit ???CN=Denver,DC=exchangeexchange,DC=local??? |
Set-User -Fax 555-1234
Whether there are 10 or 10,000 users in the organizational unit really does not matter in this example.
Pages:
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60