PowerShell Logo Small

Tee-Object



This is the built-in help made by Microsoft for the command 'Tee-Object', in PowerShell version 2 - as retrieved from Windows version 'Microsoft® Windows Vista™ Ultimate ' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Saves command output in a file or variable, and displays it in the console.

SYNTAX


Tee-Object [-FilePath] <string> [-InputObject <psobject>] [<CommonParameters>]
Tee-Object -Variable <string> [-InputObject <psobject>] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Tee-Object cmdlet sends the output of a command in two directions (like the letter "T"). It stores the output in a file or variable and also
sends it down the pipeline. If Tee-Object is the last command in the pipeline, the command output is displayed in the console.



<

RELATED LINKS

Online version: http://go.microsoft.com/fwlink/?LinkID=113417
about_Redirection
Select-Object

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

C:\PS>get-process | tee-object -filepath C:\Test1\testfile2.txt

Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
83 4 2300 4520 39 0.30 4032 00THotkey
272 6 1400 3944 34 0.06 3088 alg
81 3 804 3284 21 2.45 148 ApntEx
81 4 2008 5808 38 0.75 3684 Apoint
...



Description
-----------
This command gets a list of the processes running on the computer and sends the result to a file. Because a second path is not specified, the res
ult will be displayed in the console.








-------------------------- EXAMPLE 2 --------------------------

C:\PS>get-process notepad | tee-object -variable proc | select-object processname,handles

ProcessName Handles
----------- -------
notepad 43
notepad 37
notepad 38
notepad 38



Description
-----------
This command gets a list of the processes running on the computer and sends the result to a variable named "proc". It then pipes the resulting ob
jects along to Select-Object, which selects the ProcessName and Handles property. Note that the $proc variable includes the default information r
eturned by Get-Process.