# Print the Cmdlet Output to a log file as well as display in the Console

**URL:** <https://forums.powershell.org/t/print-the-cmdlet-output-to-a-log-file-as-well-as-display-in-the-console/18735>\
**Category:** PowerShell Help\
**Created:** [March 4, 2022, 2:34pm UTC](https://forums.powershell.org/t/print-the-cmdlet-output-to-a-log-file-as-well-as-display-in-the-console/18735 "2022-03-04T14:34:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gokul](https://avatars.discourse-cdn.com/v4/letter/g/22d042/32.png) [@Gokul](https://forums.powershell.org/u/Gokul)\
**Post date:** [March 4, 2022, 2:34pm UTC](https://forums.powershell.org/t/print-the-cmdlet-output-to-a-log-file-as-well-as-display-in-the-console/18735/1 "2022-03-04T14:34:13Z")

</div>

I need to Print the Cmdlet Output to the Console and then I wanted the same to be send to it a log file as well.

Like Start-Transcript cmdlet. Is there any way that I can achieve this.

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [March 4, 2022, 2:41pm UTC](https://forums.powershell.org/t/print-the-cmdlet-output-to-a-log-file-as-well-as-display-in-the-console/18735/2 "2022-03-04T14:41:41Z")

</div>

Gokul,  
Welcome to the forum. 👋🏽

Depending on the specific commands you want to observe or log you could use the common parameter `-OutVariable` to capture the output of a cmdlet and write it to log file later while you’re still able to see the actual output of the cmdlet on the console.

> **[about CommonParameters - PowerShell](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_commonparameters?view=powershell-7.2#-outvariable)**
>
> Describes the parameters that can be used with any cmdlet.

Another option would be to use

> **[Tee-Object (Microsoft.PowerShell.Utility) - PowerShell](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/tee-object?view=powershell-7.2)**
>
> The Tee-Object cmdlet redirects output, that is, it 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...

---

<div class="post-metadata">

**Author:** ![Gokul](https://avatars.discourse-cdn.com/v4/letter/g/22d042/32.png) [@Gokul](https://forums.powershell.org/u/Gokul)\
**Post date:** [March 11, 2022, 10:05am UTC](https://forums.powershell.org/t/print-the-cmdlet-output-to-a-log-file-as-well-as-display-in-the-console/18735/3 "2022-03-11T10:05:38Z")

</div>

Thank you so much for your help

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:18pm UTC](https://forums.powershell.org/t/print-the-cmdlet-output-to-a-log-file-as-well-as-display-in-the-console/18735/4 "2024-05-16T20:18:10Z")

</div>


