Solved

A fast way to tell if a remote PC is on?

Posted on 2003-11-13
6
263 Views
Last Modified: 2010-05-03
I'm writing a utility to scan lots of systems. Before I try to read their registry and disk drives I need to know whether they are 'on' or 'off'. I've used the www.allapi.net API routines to send a PING, but it still takes 4 - 6 seconds to return if the PC is off, and with a lot of machines that can soak up a lot of time.

In the NT4 Server Manager program, it displays a list of servers and workstations very quickly, with 'unavailable' systems greyed out. How does it do this? Is there an API that returns a system's online status?
0
Comment
Question by:crescendo
6 Comments
 
LVL 24

Expert Comment

by:R_Rajesh
ID: 9739965
Hi crescendo,

not very elegant, but you could create a mapped drive to each of those system, then check for the existance of a file in that drive. say you mapped system2's C drive to V: of you system then

if dir("v:\test.txt") = "" then its off else its on


Cheers!

Raj
0
 
LVL 5

Accepted Solution

by:
g0rath earned 500 total points
ID: 9740072
Here is a link on how to get the server list by type
http://www.devcity.net/forums/faq.asp?fid=9&cat=Networking&#TID1712

And here is how to write a local ping which may be faster then the method your using
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20724190.html

AlbertaBeef talks about using your ICMP from ALLAPI, but has a method to look for C:\My Folder and if exists do something...this may be faster then a ping
0
 
LVL 13

Expert Comment

by:AlbertaBeef
ID: 9744790
Yup, I use the ICMP ping you linked him too.  It works great.  500ms (1/2 second) timeout tells you the pc isn't there.  

You should find it works well for you, also.  I use this particular method on an application that checks 1200 workstations to ensure virus definitions are up to date.  Even with the other things I do, it scans 1200 machines and what's on and what's not and updates any out of date definitions in about 10 minutes flat.  So it's pretty quick.

1/2 second beats 4 to 6 seconds hands down . . .

Just a question though, what call are you using to get your list of workstations?  Depending on the method you may be getting names that aren't in use, and that would slow it down as you try to resolve the hostname to an IP.
0
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.

 
LVL 9

Expert Comment

by:Dang123
ID: 9747814
Listening
0
 
LVL 9

Author Comment

by:crescendo
ID: 9749256
Hi all

Sorry for the delay in replying, been off site.

I'll try the ping utility, 500mS would be fine.

I get the list of machines in the domain through ADSI, and yes, it includes systems that don't exist but still have machine accounts. I've just been experimenting with the NetServerEnum (I think that was the right name) API and it's much faster and only seems to list machines that are online at the moment. I believe it gets the list from the master browser, which explains how it knows who is 'on' at the time. I think that if I combine this API with the results from ADSI and the fast ping, I should have a solution. (I still need the ADSI list so that I can see who didn't get updated because the machine was unavailable at the time, and need to ping in case the machine goes off after I get the list).

I'll let you know how I get on.

Thanks folks
0
 
LVL 6

Expert Comment

by:DominicCronin
ID: 9750659
Have a look for some "hacker" tools. Looking for machines that are "up" is a basic requirement for hackers, and there are many "port scanner" available for free download that are highly optimised for gathering a lot of information in a short time.
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

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…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

863 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

23 Experts available now in Live!

Get 1:1 Help Now