November 2018
Intermediate to advanced
566 pages
17h 15m
English
There are situations where you need to send content to a file, as well as display the content on the console. This is handled using a simple call of Tee-Object. Tee-Object works like the letter T; apart from sending content to a file or a variable, it also sends the content down the pipeline. If Tee-Object is the last cmdlet in the statement, the pipeline output is sent out to standard output, which in most cases is the host (or in other words, the console by default).
In our recipe, we sent the first output to the file, processes.txt, and the second output was not sent down the pipeline. Therefore, Tee-Object picked the standard output.
Read now
Unlock full access