How to Ping a List of Computers With VBScript

Written by jon evans
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Ping a List of Computers With VBScript
Remote maintenance simplifies system administration. (Hemera Technologies/ Images)

If you are a system administrator, you likely perform system maintenance and backups on many computers. Most of these tasks can be done remotely, but only if the systems you are working on are powered on. Prior to beginning your scheduled maintenance, you can run a Visual Basic script that will allow you to ping the machines on your network.

Skill level:

Things you need

  • Network connection to remote machines
  • Visual Basic compiler
  • List of IP addresses for machines you wish to ping

Show MoreHide


  1. 1

    Create a list of computers based on IP addresses. Enter only the IP addresses and only one per line. Save this list as a text file; for example, save the file as "c:\serverlist.txt"

  2. 2

    Create a Visual Basic script that calls the "c:\serverlist.txt" file as a source file. This script will also output the results to the file "c:\output.csv". Use the following code:

    dim strInputPath, strOutputPath, strStatus

    dim objFSO, objTextIn, objTextOut

    strInputPath = "c:\serverlist.txt") '- location of input

    strOutputPath = "c:\output.csv") '- location of output

    set objFSO = CreateObject("Scripting.FileSystemObject")

    set objTextIn = objFSO.OpenTextFile( strInputPath,1 )

    set objTextIn = objFSO.CreateTextFile( strOutputPath )


    Do until objTextIn.AtEndOfStream = True

    strComputer = objTextIn.ReadLine
        if fPingTest( strComputer ) then
             strStatus = "UP"
             strStatus = "DOWN"
        end if
        objTextOut.WriteLine(strComputer & "," & strStatus)


  3. 3

    Compile and execute the code. Review the contents of "c:\output.csv".

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.