Jump to content

Recommended Posts

Posted

Hi All,

I've been looking around the internet for a tool that will allow me to copy and paste in a list of PC Names and ping them all but I can't find one.

Can anyone suggest how I might create a script program to achieve this aim ?

Basically I want to be able to ping a lot of PCs at once and receive information on if they respond or not, nothing more complicated than that.

Thanks for your time in advance. :o

Posted (edited)

Here is a start for you but I'm a bit to busy to make it prettier.

It pings the IP, logs the IP then comma and error result, I'm sure you can change it to what you want.

#include <file.au3>
Dim $aIPList
If Not _FileReadToArray("IPList.txt",$aIPList) Then
   MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf
For $x = 1 to $aIPList[0]
    FileWriteLine ("PingLogFile.txt", $aIPList[$x] & "," & Ping($aIPList[$x]))
Next
Edited by ChrisL
Posted (edited)

Thanks for your replies, however I cannot find the ping example in the help.

Also, when I run the script you posted Chris, it just comes up with an error on the line include <file.au3> (error: Unknown function name)

The file.au3 file is in C:\Program Files\AutoIt3\Include .. ?

Edited by ErinC
Posted

Hi, no I'm not using the beta version.

I had made a sillly mistake though .. had somehow missed out the # at the start of the line. The script runs now but still doesn't do what I require ... I need to ping machine names not ip addresses .. and the log file isn't right in it's format or info .. I don't understand the code

Posted

Hi, no I'm not using the beta version.

I had made a sillly mistake though .. had somehow missed out the # at the start of the line. The script runs now but still doesn't do what I require ... I need to ping machine names not ip addresses .. and the log file isn't right in it's format or info .. I don't understand the code

What I did works with names or IP's

the text file of computers is like:

fm01657

192.168.2.5

192.168.2.11

192.168.2.95

the resulting log file reads:

fm01657,1

192.168.2.5,0

192.168.2.11,1

192.168.2.95,0

Perhaps if you posted your list format and your code it might help

Posted

just to prove the point, I added in bbc.co.uk to the list

fm01657

www.bbc.co.uk

192.168.2.5

192.168.2.11

192.168.2.95

results:

fm01657,1

www.bbc.co.uk,21

192.168.2.5,0

192.168.2.11,1

192.168.2.95,0

fm01657 replied in 1 ms

www.bbc.co.uk replied in 21ms

192.168.2.5 didn't reply

192.168.2.11 replied in 1ms

192.168.2.95 didn't reply

Posted

Hi again Chris, and thank you for spending your time on this.

I am using the code;

#include <file.au3>
Dim $aIPList
If Not _FileReadToArray("IPList.txt",$aIPList) Then
   MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf
For $x = 1 to $aIPList[0]
    FileWriteLine ("PingLogFile.txt", $aIPList[$x] & "," & Ping($aIPList[$x]))
Next

The contents of my IPList.txt is;

ARCTDUCZC4070RD

CRELDGC00006

CRELDGC00010

CRELDGC00022

CRLIKN9Z0Z4G

LIBEWRCZC4070RB

LIBEWCZC4070RLW

LIEWJX7ZJ00KPN

LIEWJYHZN3JX

GELIDULJK1J

LIBGTDMLJK1L

CRKL36RLN1J

CRKL5P8MN1J

LIBLKCZC4070RD2

CSLI32608VV

and after running the script, I get the following in the PingLogFile.txt;

LIEWJX7ZJ00KPN,0

LIEWJYHZN3JX,0

ARCTDUCZC4070RD,0

GELIDULJK1J,0

CRELDGC00006,0

LIBGTDMLJK1L,0

CRELDGC00010,0

CRKL36RLN1J,0

CRELDGC00022,0

CRKL5P8MN1J,0

LIBLKCZC4070RD2,0

CSLI32608VV,1

CRLIKN9Z0Z4G,0

LIBEWRCZC4070RB,0

LIBEWCZC4070RLW,0

LIEWJX7ZJ00KPN,0

LIEWJYHZN3JX,0

GELIDULJK1J,0

LIBGTDMLJK1L,0

CRKL36RLN1J,0

CRKL5P8MN1J,0

LIBLKCZC4070RD2,0

CSLI32608VV,1

So from what your example I can see that it is actually working ok after all but it doesn't seem to be giving reliable results when I compare the results of manually pinging the machine names

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...