Search This Blog

Tuesday, June 14, 2016

Powershell: Ping with timestamp, logging and tail

I include a refernce to the page where I found out how to timestamp each ping request at the bottom of this article.

This code excerpt will timestamp each ping request, redirect it to a log file and then we can use the get-content command to look at the contents of the log file as it is written to (like tail in linux)


filter timestamp {"$(Get-Date -Format o): $_"}
& ping servername -t | timestamp > c:\logging.txt
Get-Content c:\logging.txt -wait





No comments:

Post a Comment