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

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

  1. Pingback: Powershell Tip #94: Delete files and folder longer than 259 characters | Powershell Guru

Leave a Reply

Your email address will not be published. Required fields are marked *