Enumerating computers within an IP Range

Hi all,

I've developed a program for a specific text-based program that writes custom configuration files for a type of pc-based controller we use.

The goal, however, is for the program to be used on one main system, usually a laptop, with several systems that are identical to eath other, and all exist within a small IP range ie 192.168.10.100 -> 192.168.10.112.

What I need to do is to be able to copy a small text file, very similar to a config file, into a specific directory on each of the remote systems.

The main system's logged-in user is already authorised as an administrator to the other systems, so authentication won't be a problem, but I would like to have the ability to identify the other systems, and subsequently copy a text file over to them.

I'm hoping to use the same data to list the computers that are found in that range in a display that is similar to network neighborhood, to allow the operator to see if all the machines are responding.

I'd be happy (at a very simple level) to just be able to test whether a machine is responding to a 'ping' but I'd like to be a little more 'finessed' in how this is approached.

Thanks for taking the time to read this!

[1213 byte] By [Nathan.Aus] at [2007-12-16]
# 1
Hi Nathan,

Good question! Unfortunately I'm not aware of any easy way to do this (the System.Net.Sockets namespace might have something for ICMP ping, but I couldn't find it). This is a bit hacky, but it should work:

Dim ips() As String = {"192.168.10.100", "192.168.10.101"}
For Each ip As String In ips
Try
System.IO.Directory.GetFiles("\\" + ip + "\YourShare")
' Success, go for it
Catch ex As System.IO.IOException
' Failure, continue
End Try
Next

RyanCavanaughMS at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 2

Is that vb.net code? cos i'm (still) using vb6...!

I thought I didn't recognize a Try loop, or Catch...!

Thanks for the idea though - it's almost what I was trying earlier using the File System Object.

Can u translate this into VB6?

Thanks again,

Nathan.

Nathan.Aus at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic Language...