Have a function which I call during my script and use to write output to the screen, I would also like to out put the same information to a log file.
I have tried to pipe the output to a file using out-file but I dont see the log file created nor an error. I see the output on screen but not a log file
$TextBlock1 = $args
$TextBlock2 = $args
$TextBlock3 = $args
$Stamp = Get-Date
Write-Output “[$Stamp] [$Section - $TextBlock1]” | Out-file -Append -FilePath ‘C:\Script\Log.txt’