Finding network computer status more quickly

Posted on 2008-06-25
Last Modified: 2010-05-18
I am running a code that is querying a folder on all of my remote computers in order to see if the computer is turned on or off.

Now the code works perfectly, but when there is a computer turned off the timeout is very long.  I am wondering if there's a way I can speed up the process for failed computers.

Dim LastRow As String

    Dim i As Integer

    Dim Computer As String

    Dim fso As New FileSystemObject

    Dim d


    LastRow = Range("A65536").End(xlUp).Row

    On Error Resume Next


    For i = 1 To LastRow

            Computer = Range("A" & i & "").Value

            fso.GetFolder ("\\" & Computer & "\c$")


            If Err.Number <> 0 Then


                Cells(i, 2) = "Fail"


                Cells(i, 2) = "Good"

            End If

    Next i

Open in new window

Question by:ScotTFO
1 Comment

Accepted Solution

ScotTFO earned 0 total points
ID: 21898649
I have resolved this issue myself using:
Function SystemOnline(ByVal ComputerName As String)

    Dim colPingResults As Variant

    Dim oPingResult As Variant

    Dim strQuery As String

    strQuery = "SELECT * FROM Win32_PingStatus WHERE Address = '" & ComputerName & "'"

    Set colPingResults = GetObject("winmgmts://./root/cimv2").ExecQuery(strQuery)

    For Each oPingResult In colPingResults

        If Not IsObject(oPingResult) Then

            SystemOnline = False

        ElseIf oPingResult.StatusCode = 0 Then

            SystemOnline = True


            SystemOnline = False

        End If


End Function

Open in new window


Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Article by: dandraka
There are several quick shortcuts that can make your life easier in Microsoft Programs.  These simple tips and tricks will your work more productive and you faster at completing your tasks! MS Word (1) Creating Re-usable Scraps You can create s…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now