Powershell Tip #93: Use the “2 in 1” cmdlet Tee-Object

By | March 1, 2016

Tip: This cmdlet Tee-Object is a “2 in 1”, it performs 2 operations at the same time:

1 – Output to a file or variable
2 – Output to the console

Without Tee-Object (Action 1 and Action 2 are “separate”)

get-service-tee-object

get-content-without-tee-object

With Tee-Object (Action 1 and Action 2 are “simultaneous”)

Case 1 : Output to a file (+ console)

get-service-with-tee-object

Case 2 : Output to a variable (+ console)

get-service-tee-object-variable-services

tee-object-services


previous-buttonnext-button

Leave a Reply

Your email address will not be published.