Solved

Finding network computer status more quickly

Posted on 2008-06-25
1
246 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Office 365 Advanced Training for Admins

Special Offer:  Buy 1 course, get 2nd free!  Buy the 'Managing Office 365 Identities & Requirements' course w/ Accelerated TestPrep, and automatically receive the 'Enabling Office 365 Services' course FREE!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel VBA inserting a formula 12 37
need help to look for 16 42
how to read data from all excel sheet and copy it in in Master sheet 2 24
count number 10 28
Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
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…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

737 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