Solved

Finding network computer status more quickly

Posted on 2008-06-25
1
244 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MS Excel Multi Sheet Formula 13 36
Set WorkSheet  not Working 9 44
extract zip code or specific digits from text address 6 24
Need help with Clear Macro 4 26
Introduction Perhaps more familiar to developers who primarily use VBScript than to developers who tend to work only with Microsoft Office and Visual Basic for Applications (VBA), the Dictionary is a powerful and versatile class, and is useful …
Introduction It seems that at least a couple of times per month, I answer a question that requires automating Outlook from another Microsoft Office application, usually (although not always) to send one or more email messages.  For example: …
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

828 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