Powershell 2.0 Write output to display and append to file

Hi,

I would like to display a message in PowerShell and append the message to a log file.   In PowerShell 4.0 you can use Tee-Object -Append but I don't think they have the -Append option in PowerShell 2.0.    Is there an simple way to write a message to the screen and log file at the same time?   Thank you.

David

PS UnfortunatelyI can't upgrade to PowerShell 4.0.
davidst98Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
SubsunConnect With a Mentor Commented:
What about using Add-Content with -PassThru switch? for example..
"Some data" | Add-Content c:\temp\log.txt -PassThru

Open in new window

0
 
davidst98Author Commented:
Thanks!   That works perfect.
0
All Courses

From novice to tech pro — start learning today.