Microsoft Virtualization Discussions

write to file

JSHACHER11
5,991 Views

I have a script which outputs the results to a text file with 'Out-File -Append'

I want to add a few lines to the text file:

$time = (Get-Date -format dd-MM_HH-mm)

Write-Host "*********************************************************************"

Write-Host "New Reading - $time"

Write-Host "*********************************************************************"

the above sends it to the console and not to the file itself

how do I put that in the file?

Thank you

12 REPLIES 12
Public