You are here:

WindowsManagement.com > PowerShell > PowerShell 1.0 > Tee-Object
ActiveXperts Network Monitor 2019 proactively manages network servers, devices, databases and more.

Tee-Object - PowerShell 1.0

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.

Tee-Object


Description
Back up your Hyper-V VMs Easy & Fast. 100% built for Hyper-V. Free for 2 VMs, forever.

Usage


Options
-inputObject psobject
       The object to tee.
       Enter a variable, command or expression that gets the objects.
	  
   -filePath string
       Save the input object(s) to a file named string.

   -variable string
       Assign the input object(s) to a variable named string.

   CommonParameters:
      -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutVariable.

Example(s)
Get a list of the processes running and send to a file and also the console:

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

Get a list of the processes running and send to two files at once:

PS C:\>get-process | tee-object -filepath C:\fileA.txt | out-file C:\fileB.txt

Save a list of processes to a variable (myprocs) then use Tee-Object to save the myprocs to file and also display on the console:

PS C:\>$myprocs = Get-Process |Select-Object processname,handles
PS C:\>Tee-Object -inputObject $myprocs -filepath C:\fileC.txt