What is the better way to know if the program has access to another computer in the local network

Posted on 2006-04-04
Last Modified: 2010-05-01
I am doing a program (Visual Basic 6) that access to another computer in the local network, so I need to make a function that tells me if the computer is accessible. Only this, if it is accessible.

I have the name (not the IP) of the computer to test if I have access, and perhaps the computer running the program has no access to a DNS server (for example, a laptop that it is not at the office). Both computers, the one which is running the program and the one that must be accessed, belong to a Windows Domain in a Windows 2000 or Windows 2003 environment).

The question is that this function must answer as fast as possible.

Essentially, I need to know if the destination computer has a SQL Server and if it is sharing a -specific- directory.
Question by:gllanderas
    LVL 24

    Accepted Solution

    LVL 1

    Author Comment

    Thanks, hes, but I'm looking for something faster.

    I wonder if is possible to do using WMI. I did a experiment with this code (vbscript):

    On Error Resume Next

    strConnection = "winmgmts:\\comp1"

    Set objWMIService = GetObject(strConnection)
    lngError = Err.Number
    Set objWMIService = Nothing

    If lngError = 0 Then
      MsgBox "OK."
      MsgBox "NOK:" & CStr(lngError)
    End If

    But this seems to work only if the user is a member of the administrative group of the domain.
    LVL 1

    Author Comment

    hes, thanks for your help.

    I assume that the only way to do this is sending a ping to the computer with the code posted in that link.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
    Introduction While answering a recent question ( in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    761 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

    6 Experts available now in Live!

    Get 1:1 Help Now