Logging
Start-Transcript & Stop-Transcript
# direct output will not be logged
$logFile = "$PSScriptRoot\mylog.txt"
Start-Transcript -Path $logFile -Append
#########################################
"Start logging"
($a = Get-Service)
"I received $($a.Count) services."
"End Logging"
# end logging ###########################
Stop-Transcript