keilamym Posted November 15, 2006 Share Posted November 15, 2006 maybe someone can answer this one quick... is there a way to return the actual ping results to a log file, rather than using the error codes? Current script... ************************ $ping = Ping( $line ,500) If @error = 4 Then _FileWriteLog(@TempDir & "\Failure.log", "Unknown Ping error " & $line) ElseIf @error = 3 Then _FileWriteLog(@TempDir & "\Failure.log", "Bad Destination " & $line ) ElseIf @error = 2 Then _FileWriteLog(@TempDir & "\Failure.log", "Host is unreachable " & $line ) ElseIf @error = 1 Then _FileWriteLog(@TempDir & "\sms2k3clientrepair\Failure.log", "Host is offline " & $line ) Else begin rest of script here... ************************** I'd like to send the ping results to a variable and just have it logged. Thanks in advance Link to comment Share on other sites More sharing options...
Fossil Rock Posted November 15, 2006 Share Posted November 15, 2006 Ping IP Address > IP.txt Agreement is not necessary - thinking for one's self is! Link to comment Share on other sites More sharing options...
keilamym Posted November 15, 2006 Author Share Posted November 15, 2006 Ping IP Address > IP.txtfossil...any ideas how to get it back to the same Failure.log file? Link to comment Share on other sites More sharing options...
Fossil Rock Posted November 15, 2006 Share Posted November 15, 2006 Not sure what you mean. Agreement is not necessary - thinking for one's self is! Link to comment Share on other sites More sharing options...
keilamym Posted November 15, 2006 Author Share Posted November 15, 2006 (edited) Not sure what you mean.I wrote a tool that logs the work its doing by using the _filewritelog command. when you use the >txt command, it will save the data by ip.txt but I run it on over 1000 workstations at a time. This means I'll have over a 1000 logs...how can i get it to append to the log file i created using the _filewritelog command?MAYBE save to the ip.txtread the single line on the txt to a variableuse the _filewritelog command to write the variable info to the current log filedelete the ip.txt filethis might work but it doesn't seem to smooth.id rather read somehow read the info to a variable without having to save to a file, read the file, then delete it if possible but i cant find any command that will do it.the ping command in auto i think only returns error codes so i cant put it into a file. so i'd have to switch to something like run = Run@ComSpec & " /c ping " & $linethanks Edited November 15, 2006 by keilamym Link to comment Share on other sites More sharing options...
Blue_Drache Posted November 15, 2006 Share Posted November 15, 2006 (edited) ping >> NetDrive:\Folder\ip.txt (note the >> ... means append.) But...your method does seem to work. Kludgy...but operational...what exactly are you digging for? Your _filewritelog() will have the same problem as mine though.... if a machine tries to write to the log when it's already open, it'll bomb horribly unless you write a routine to check for that. Edited November 15, 2006 by Blue_Drache Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
keilamym Posted November 15, 2006 Author Share Posted November 15, 2006 (edited) ping >> NetDrive:\Folder\ip.txt(note the >> ... means append.)But...your method does seem to work. Kludgy...but operational...what exactly are you digging for?drache...i wrote tool to help troubleshoot SMS advance clients... Autoit scripts in the back with a Wise front end gui interface... i'll try these suggestions... i never thought about the if its already open though... i'll have to look at that.thanks.. Edited November 15, 2006 by keilamym Link to comment Share on other sites More sharing options...
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