'How to get console output of Get-AdUser but also pipe it into another command? [duplicate]
I am trying to run a get-aduser command and | it into a set-aduser command, but how do I display the get-aduser command and also pipe it into the set-aduser?
Thanks
Solution 1:[1]
Pipe the output of the Get-ADUser command to a scriptblock that displays it and also executes the Set-ADUser command:
Get-ADUser ... | ForEach-Object { $_ ; Set-ADUser $_ ... }
The first $_ displays the object returned by Get-ADUser; the second passes it to the Set-ADUser command.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
