Cyber Tech Help Support Forums

Cyber Tech Help Support Forums (https://www.cybertechhelp.com/index.php)
-   Networking (https://www.cybertechhelp.com/forumdisplay.php?f=17)
-   -   Getting PINGed Results Sortable/Filtered (https://www.cybertechhelp.com/showthread.php?t=234340)

CyberTrek October 8th, 2020 12:46 AM

Getting PINGed Results Sortable/Filtered
 
I am trying to figure a way to make a simple, sortable or filterable ping script. I got a few, meh, thousand servers I need to ping. Now, I can have them all in a file. I can execute it from Command Prompt or Powershell for it to ping everything and append to a file. The problem is the output. Just comes out like regular ping results, since, well, I am using ping. So whether I run

ips.txt:
server1
server2

from Command Prompt:

C:\Users\me>for /f "tokens=1" %a in (c:\temp\ips.txt) DO @ping -n 3 %a >> c:\temp\PingResults.txt

Or

ips.ps1:
ping server1 -n 2 >> “c:\temp\IP_Results.txt"
ping server2 -n 2 >> “c:\temp\IP_Results.txt"

(or even if CSV is the output)

In Powershell:

Pings are all complete results located in c:\temp\IP_Results.txt.
PS C:\WINDOWS\system32> & C:\temp\IP_Results.ps1

Both give me the same results in the outputted file, which I know is expected of ping.

Pinging server1 [10.111.123.248] with 32 bytes of data:
Request timed out.
Request timed out.

Ping statistics for 10.111.123.248:
Packets: Sent = 2, Received = 0, Lost = 2 (100% loss),

Pinging server2 [10.111.123.249] with 32 bytes of data:
Request timed out.
Request timed out.

Ping statistics for 10.111.123.249:
Packets: Sent = 2, Received = 0, Lost = 2 (100% loss),

Fine and dandy. What I would really like is to have all the servers in an output that shows me at least three key bits of info I need, like:

Server1, 10.1.1.2, inactive/time out/whatever
Server2, 10, 2, 3, 4, active/pinged/whatever

I want to be able to have it all into a list so I can at least, like in a spreadsheet, filter out all the ones that failed knowing what their server names and IPs are, so I can work on those. Rather than having to go through the generic ping results like above for 2000 results.

Know what I mean?

Thanks.


All times are GMT +1. The time now is 12:38 AM.

Copyright © Cyber Tech Help. All rights reserved. All other trademarks are the property of their respective owners.