Write to a text file using Powershell

While looking for a method to generate some logging in a Powershell script to aid debugging I came across several suggestions… #Method 01 – appends contents $LogFile =”C:\PsTools\Method01.log” $DateTime = Get-Date Write-Output $DateTime “Performing some operation” | Add-Content $LogFile #Method 02 – appends contents Add-Content “C:\PsTools\Method02.log” “Performing some operation” #Method 03 – overwrites existing contents Write-Output “Performing some operation” | […]