Novice to PowerShell. Trying basic examples.
I'm trying to append TimeStamp to a Custom Message while writing information to log file.
function Get-TimeStamp {
return Get-Date -Format yyyymmdd_hhmmss
}
write-host '[INFO].['$(Get-TimeStamp)'] Message'
The output comes as below:
[INFO].[ 20184827_054844 ] Message
Can someone please point out me in getting rid of the extra spaces before and after timestamp?