Ping with timestamp and logging

Open Powershell

Start-Transcript to record your Powershell Session

Start-Transcript -path C:\Temp\Ping-logging.txt -Append

Now timestamp the ping command

Ping.exe -t spiceworks.com | ForEach {"{0} - {1}" -f (Get-Date),$_}

More information about the command and the -F format operator can be found here.

PowerShell: Using the -F format Operator

https://social.technet.microsoft.com/wiki/contents/articles/7855.powershell-using-the-f-format-operator.aspx

Create a Transcript of What You Do in Windows PowerShell

https://learn.microsoft.com/en-us/previous-versions/technet-magazine/ff687007(v=msdn.10)?redirectedfrom=MSDN

The -f Format operator

https://ss64.com/ps/syntax-f-operator.html

Leave a Reply

Your email address will not be published. Required fields are marked *