Redirect write-host outputs to text file

@Olaf, I used “Log message” instead of write-host.

and did this way:

Test_log 2>&1 4>&1 6>&1|Out-File C:\temp\log.txt

I was able to get the log messages in the log file, however, now I am not able to view it on console :expressionless:

with just calling function, I am able to see “Log message” and also the verbose messages which are contained in the function, but when I redirect them, won’t they be shown again on the console?

Could you suggest me a way ?