Powershell function that displays user friendly messages as well as optionally logging it to a file. When logging to a file, it timestamps the message as well. If the -Logfile parameter is not set, it only displays the message. See the examples below for more info.
Write-Update "This is a sample message" -UpdateType Normal -Logfile $Logfile
"This is a success message" | Write-Update -UpdateType Success -Logfile $Logfile
Write-Update "This is a success message" -UpdateType Success -Logfile $Logfile
Write-Update "This is a warning message" -UpdateType Warning -Logfile $Logfile
Write-Update "This is an error message" -UpdateType Error -Logfile $Logfile
Write-Update "This is a header message" -UpdateType Header -Logfile $Logfile
Finally, here is what the log looks like. Note the timestamps on each non-header message.