Solved

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

Posted on 2003-11-13
6
262 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

708 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

15 Experts available now in Live!

Get 1:1 Help Now