|
-
Feb 18th, 2003, 01:18 AM
#1
Thread Starter
Hyperactive Member
computers on a network
hi all,
i'm sure this could be done fairly easy in .Net but I can't figure it out, so how to use VB.Net to list all the computers on a network or domain???
All help appreciated. thanx...
-
Feb 18th, 2003, 08:06 AM
#2
Thread Starter
Hyperactive Member
So no one on this....???
-
Feb 18th, 2003, 08:16 AM
#3
Sleep mode
-
Feb 18th, 2003, 08:20 AM
#4
Sleep mode
It's C# and it's stupid way to what you want from AD.Let me check something there
-
Feb 18th, 2003, 09:13 AM
#5
Sleep mode
-
Feb 20th, 2003, 01:34 AM
#6
Thread Starter
Hyperactive Member
Well i've already checked those 2 links before but none seems to satisfy me, the first one is in C# and the second one in C, what I need is some piece of code in VB.Net, though C# can be embedded or eveb translated into VB apps I was hoping that someone did this in VB.net. There seems to be a way using Microsoft Active Directory.. still trying.... 
Alternatively, what I was planning to do is to shell a Net View command from VB and make it output in into a text file, then read that text file and retrieve the list of computers on the network, Shelling this Dos command works fine in classic VB but it seems that in .Net the command is excuted but no file is created. My sample code is:
VB Code:
Shell("net view >> c:\NetList.txt", AppWinStyle.Hide)
can someone help!!!
-
Feb 20th, 2003, 02:11 AM
#7
If you set an imports and reference to DirectoryServices then this will list all computers in a domain. Note: It doesn't matter if they are actively connected at the time or not just if they are added to the Active Directory.
VB Code:
Dim de As New System.DirectoryServices.DirectoryEntry("WinNT://MyDomainName")
Dim d As System.DirectoryServices.DirectoryEntry
ListBox1.Items.Clear()
For Each d In de.Children
If d.SchemaClassName = "Computer" Then
ListBox1.Items.Add(d.Name)
End If
Next
-
Feb 20th, 2003, 03:12 AM
#8
Thread Starter
Hyperactive Member
I tried your above example but it seems to give me only the list of users and services that the server is running, its cannot identify the computer names....
-
Feb 20th, 2003, 03:37 AM
#9
Are there any computers added to the active directory? (Not just connected to the network)
Are you using the Domain root not a child computer?
-
Feb 20th, 2003, 03:59 AM
#10
Thread Starter
Hyperactive Member
In fact I can't figure out if the computers are added to the active directory. The domain server is an NT 4.0 server.
Also i'm running the app from a computer connected to the network of the domain server, not the root server itself. Could this possible be the problem?
Actually i'm trying to write a file distribution program that will be used by users over a network. So using sockets, and maybe directory services, I have to detect all computers connected to the network and list them. Then the user will select a set of computers and send them a file. So the computer listing part is still pending...
-
Feb 20th, 2003, 04:28 AM
#11
Well the trouble is that NT 4.0 Server doesn't have Active Directory. You need a Windows 2000 Server or better.
So you can scratch the Active Directory/Directory Services bit. It also sounds like you need the active computers which aren't listed with Active Directory anyway.
The easiest way to do this is run some sort of custom server app that all the clients connect to and just query that.
I only have some vb6 code to list active computers on a network and I'm not sure what OS is required for it. It uses mainly API calls, but I don't have the link handy right now sorry.
-
Feb 20th, 2003, 05:52 AM
#12
Thread Starter
Hyperactive Member
Well thanx anyway, i'll have a look at the possibility of using other alternatives.
-
Feb 20th, 2003, 08:40 AM
#13
Frenzied Member
VB Code:
Dim FF As File, FS As StreamWriter, St As String
St = "C:\" & CInt(Rnd() * 10000).ToString & ".bat"
While FF.Exists(St)
St = "C:\" & CInt(Rnd() * 10000).ToString & ".bat"
End While
FS = New StreamWriter(St)
FS.WriteLine("net view > C:\netview.txt")
FS.Close()
Shell(St, AppWinStyle.Hide, True)
FF.Delete(St)
Last edited by Lunatic3; Feb 20th, 2003 at 08:51 AM.
-
Feb 20th, 2003, 12:08 PM
#14
Sleep mode
Originally posted by Lunatic3
VB Code:
Dim FF As File, FS As StreamWriter, St As String
St = "C:\" & CInt(Rnd() * 10000).ToString & ".bat"
While FF.Exists(St)
St = "C:\" & CInt(Rnd() * 10000).ToString & ".bat"
End While
FS = New StreamWriter(St)
FS.WriteLine("net view > C:\netview.txt")
FS.Close()
Shell(St, AppWinStyle.Hide, True)
FF.Delete(St)
?????????
-
Feb 20th, 2003, 12:23 PM
#15
Frenzied Member
Oh
I thought anyone reading the thread will understand that the code was an answer to:
Alternatively, what I was planning to do is to shell a Net View command from VB and make it output in into a text file, then read that text file and retrieve the list of computers on the network, Shelling this Dos command works fine in classic VB but it seems that in .Net the command is excuted but no file is created. My sample code is:
visual basic code:
--------------------------------------------------------------------------------
Shell("net view >> c:\NetList.txt", AppWinStyle.Hide)
--------------------------------------------------------------------------------
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|