Solved

Finding network computer status more quickly

Posted on 2008-06-25
1
242 Views
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.

Thanks
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

                Err.Clear

                Cells(i, 2) = "Fail"

            Else

                Cells(i, 2) = "Good"

            End If
 

    Next i

Open in new window

0
Comment
Question by:ScotTFO
1 Comment
 

Accepted Solution

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

        Else

            SystemOnline = False

        End If

    Next

End Function

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

929 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

10 Experts available now in Live!

Get 1:1 Help Now