Ping test

by Oct 18, 2013

Hi,

I have a script (test-connection) that checks the servers are pingable or not, no problem with it,
but I need is the ip addresses for each server, even if they can be pinged or not. I would like to put Ip addresses info next to pingable and down in output text Do you have any idea?

Thanks in advance

Script:
get-content G:servers.txt | foreach { if (test-connection $_ -quiet)
  { write-output "$_ is Pingable" | out-file g:output.txt -append }
else
  {write-output "$_ is Down" | out-file g:output.txt -append}}

Thanks, R.