Simple powershell ping log with timestamp
Here's a quick and dirty script that will ping with a timestamp, and save the ouput to a text file. I have used pingInfoView quite a bit, but sometimes this fits the situation better.
$hostAddress = Read-Host -Prompt 'IP Address or Hostname'
$fileName = Read-Host -Prompt 'Output file'
ping.exe -t $hostAddress|Foreach{"{0} - {1}" -f (Get-Date),$_}| Tee-Object -file $fileName
$hostAddress = Read-Host -Prompt 'IP Address or Hostname'
$fileName = Read-Host -Prompt 'Output file'
ping.exe -t $hostAddress|Foreach{"{0} - {1}" -f (Get-Date),$_}| Tee-Object -file $fileName
Comments
Post a Comment