title: Ping script with loop and save in a txt
body: <p>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.</p>
  
  <p>For Example:</p>
  
  <p>06/08/2010 - 13:53:22 | The Computer "..." is online</p>
  
  <p>06/08/2010 - 13:53:24 | The Computer "..." is offline</p>
  
  <p>Now i try a little bit:</p>
  
  <pre><code>   strComputer = "TestPC"
  
      Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._
       ExecQuery("select * from Win32_PingStatus where address = '"_
       &amp; strComputer &amp; "'")
      For Each objStatus in objPing
       If IsNull(objStatus.StatusCode) Or objStatus.StatusCode &lt;&gt; 0 Then 
  
      ..........          
  
      Next
  </code></pre>
  
  <p>And than i don't know how to make it. (I'm new with vbs :-))</p>
  
  <p>I hope some one can help me.</p>
  
  <p>Greeting,
  matthias</p>