Tracert command continouslt

  • 178 Views
  • Last Post 13 December 2017
yogeshcittu posted this 26 November 2017

Hi All,
Anyone who can help me with a script to run tracert command continoulsy which should be able to generate log file with date and time.
Regards,

Order By: Standard | Newest | Votes
bshwjt posted this 26 November 2017

You can schedule it in every minute.
$CurrentDate = Get-Date$CurrentDate = $CurrentDate.ToString('MM-dd-yyyyhh-mm-ss')Test-NetConnection -ComputerName ANA-TRP01.CONTOSO.COM -TraceRoute | Out-File C:\scripts\Tracert$CurrentDate.txt


show

robjvargas posted this 27 November 2017

Have you looked at WinMTR?
Not logging, per se, but you can export the results.
http://winmtr.net/download-winmtr/
On November 25, 2017 at 8:12 PM Yogesh cittu <yogeshcittu@xxxxxxxxxxxxxxxx> wrote:
Hi All,
Anyone who can help me with a script to run tracert command continoulsy which should be able to generate log file with date and time.
Regards,


 

webster posted this 27 November 2017

Why not do the date in one line?

 

PS C:\Users\cwebster> $CurrentDate = (Get-Date).ToString('MM-dd-yyyyhh-mm-ss')

PS C:\Users\cwebster> $currentdate

11-27-2017
08-05-53

PS C:\Users\cwebster>

 

Or better yet, do the whole thing as one line:

 

PS C:\Users\cwebster> Test-NetConnection -ComputerName carlwebster.com | Out-File c:\users\cwebster\"Tracert$((Get-Date).ToString('MM-dd-yyyyhh-mm-ss')).txt"

PS C:\Users\cwebster> dir trace*.txt

 

 

    Directory: C:\Users\cwebster

 

 

Mode                LastWriteTime         Length Name

----                -------------         ------ ----

-a----       11/27/2017   8:11 AM            462 Tracert11-27-201708-11-07.txt

 

 

PS C:\Users\cwebster>

 

Webster

 

show

michael1 posted this 27 November 2017

Make it portable. J

 

Test-NetConnection -ComputerName carlwebster.com | Out-File ( Join-Path $pwd "Tracert$((Get-Date).ToString('MM-dd-yyyyhh-mm-ss')).txt" )

 

 

show

webster posted this 27 November 2017

I had to leave something for you to do.

😊

 

 

Webster

 

show

kurtbuff posted this 27 November 2017

Test-NetConnection -ComputerName contoso.com -traceroute | Out-File ( Join-Path $pwd "Tracert$((Get-Date).ToString('yyyy-MM-ddhh-mm-ss')).txt")
FTFY - obxkcd:
https://xkcd.com/1179/
ūüėÄ
Kurt


show

GuyTe posted this 13 December 2017

And now using zulu time for time zone challenged:

 

Test-NetConnection -ComputerName contoso.com -TraceRoute | Out-File (Join-Path $pwd "Tracert$(([DateTime]::UtcNow).ToString("yyyy-MM-dd'T'HH-mm-ss'Z'")).txt")

 

😛

 

show

Close