Jump to content

Logging PING results


keilamym
 Share

Recommended Posts

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

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.txt

read the single line on the txt to a variable

use the _filewritelog command to write the variable info to the current log file

delete the ip.txt file

this 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 " & $line

thanks

Edited by keilamym
Link to comment
Share on other sites

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 by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

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 by keilamym
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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