If you are scripting and logging your actions you will want to incorporate a timestamp of sorts. The following is a solid way of doing so:
- In Powershell:
get-date -format ^"{yyyy-MM-dd HH:mm:ss}^"
- In CMD you would just call Powershell:
powershell get-date -format ^"{yyyy-MM-dd HH:mm:ss}^"
- Send your output to a log file:
powershell get-date -format ^"{yyyy-MM-dd HH:mm:ss}^" >> C:\logs\scriptlog.txt