July 2017
Intermediate to advanced
648 pages
31h 9m
English
You can use advanced pipelining techniques to send objects across the pipeline to other cmdlets that do not support direct pipeline input. For example, the following one-liner adds a list of users to a group:
Get-User |
Where-Object{$_.title -eq "Exchange Admin"} | Foreach-Object{
Add-RoleGroupMember -Identity "Organization Management" `
-Member $_.name
}
This pipeline command starts off with a simple filter that returns only the users that have their Title set to Exchange Admin. The output from that command is then piped to the ForEach-Object cmdlet that processes each object in the collection. Similar to the Where-Object cmdlet, the ForEach-Object cmdlet processes each item from the pipeline using a script block. ...
Read now
Unlock full access