Ping script with loop and save in a txt
Posted
by matthias
on Stack Overflow
See other posts from Stack Overflow
or by matthias
Published on 2010-06-08T11:59:49Z
Indexed on
2010/06/08
12:02 UTC
Read the original article
Hit count: 465
Hello,
i try to make an Ping script with vbs. I need a Script, that ping (no ping limit, the program will run all the time) a computername in the network every 2 seconds and save the results in a txt file.
For Example:
06/08/2010 - 13:53:22 | The Computer "..." is online
06/08/2010 - 13:53:24 | The Computer "..." is offline
Now i try a little bit:
strComputer = "TestPC"
Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._
ExecQuery("select * from Win32_PingStatus where address = '"_
& strComputer & "'")
For Each objStatus in objPing
If IsNull(objStatus.StatusCode) Or objStatus.StatusCode <> 0 Then
..........
Next
And than i don't know how to make it. (I'm new with vbs :-))
I hope some one can help me.
Greeting, matthias
© Stack Overflow or respective owner