I am requesting ideas on manipulating output from an array and parse to something useful
- by Cyber Demon
First I am new to PS scripting. Please be gentle. This simple script I have written is ok.
$Iplist = Get-Content ips.txt
foreach ($ip in $Iplist)
{
.\psping -h -n 3 -w 0 $ip >> results.csv
}
Move-Item "C:\ping\results.csv" ("C:\ping\aftermath\{0:yyyyMMddhhmm}.csv" -f (get-date))
The Output is as follows, as an example (I used www.google.com):
Pinging 74.125.225.48 with 32 bytes of data:
3 iterations (warmup 0) ping test:
Reply from 74.125.225.48: 54.14ms
Reply from 74.125.225.48: 54.85ms
Reply from 74.125.225.48: 54.48ms
Ping statistics for 74.125.225.48:
Sent = 3, Received = 3, Lost = 0 (0% loss),
Minimum = 54.14ms, Maximum = 54.85ms, Average = 54.49ms
Latency Count
54.14 1
54.17 0
54.21 0
54.25 0
54.29 0
54.32 0
54.36 0
54.4 0
54.44 0
54.47 1
54.51 0
54.55 0
54.59 0
54.62 0
54.66 0
54.7 0
54.74 0
54.77 0
54.81 0
54.85 1
What I'm looking for is something to show me the following as an output.
ServerIP Name TimeStamp Results AverageResponseTime in milli-seconds
www.google.com 2014-08-14T16:09:59 Up 53
Can you guide me?