ErinC Posted February 14, 2006 Posted February 14, 2006 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.
sandyd Posted February 14, 2006 Posted February 14, 2006 (edited) Look in Help under Ping, there's an example there. Edit: Spelling Edited February 14, 2006 by sandyd ----[ SandyD ]---
ChrisL Posted February 14, 2006 Posted February 14, 2006 (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 February 14, 2006 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
ErinC Posted February 14, 2006 Author Posted February 14, 2006 (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 February 14, 2006 by ErinC
PerryRaptor Posted February 14, 2006 Posted February 14, 2006 Are you using the latest Beta version of AutoIT?
ErinC Posted February 14, 2006 Author Posted February 14, 2006 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
ChrisL Posted February 14, 2006 Posted February 14, 2006 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 codeWhat I did works with names or IP'sthe text file of computers is like:fm01657192.168.2.5192.168.2.11192.168.2.95the resulting log file reads:fm01657,1192.168.2.5,0192.168.2.11,1192.168.2.95,0Perhaps if you posted your list format and your code it might help [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
ChrisL Posted February 14, 2006 Posted February 14, 2006 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 [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
ErinC Posted February 14, 2006 Author Posted February 14, 2006 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
ChrisL Posted February 14, 2006 Posted February 14, 2006 OK try changing the time out value >>> Ping($aIPList[$x],10000) (I would also use the beta build if I were you, I'm sure someone changed something fairly recently) [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now