Results 1 to 15 of 15

Thread: computers on a network

  1. #1

    Thread Starter
    Hyperactive Member vbud's Avatar
    Join Date
    Jan 2002
    Location
    Mru 20 17S, 57 33E Goal: Get out of the BOX Status: In The Shadows!!! Target Posts: 3,000,000,000
    Posts
    378

    Cool 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...
    >!v!<
    Free your mind, stop thinking
    http://inspirone.blogspot.com

    Please rate this post if it helped you

  2. #2

    Thread Starter
    Hyperactive Member vbud's Avatar
    Join Date
    Jan 2002
    Location
    Mru 20 17S, 57 33E Goal: Get out of the BOX Status: In The Shadows!!! Target Posts: 3,000,000,000
    Posts
    378

    Unhappy

    So no one on this....???
    >!v!<
    Free your mind, stop thinking
    http://inspirone.blogspot.com

    Please rate this post if it helped you

  3. #3
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    It's C# and it's stupid way to what you want from AD.Let me check something there

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

  6. #6

    Thread Starter
    Hyperactive Member vbud's Avatar
    Join Date
    Jan 2002
    Location
    Mru 20 17S, 57 33E Goal: Get out of the BOX Status: In The Shadows!!! Target Posts: 3,000,000,000
    Posts
    378
    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:
    1. Shell("net view >> c:\NetList.txt", AppWinStyle.Hide)

    can someone help!!!
    >!v!<
    Free your mind, stop thinking
    http://inspirone.blogspot.com

    Please rate this post if it helped you

  7. #7
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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:
    1. Dim de As New System.DirectoryServices.DirectoryEntry("WinNT://MyDomainName")
    2.         Dim d As System.DirectoryServices.DirectoryEntry
    3.         ListBox1.Items.Clear()
    4.         For Each d In de.Children
    5.             If d.SchemaClassName = "Computer" Then
    6.                 ListBox1.Items.Add(d.Name)
    7.             End If
    8.         Next

  8. #8

    Thread Starter
    Hyperactive Member vbud's Avatar
    Join Date
    Jan 2002
    Location
    Mru 20 17S, 57 33E Goal: Get out of the BOX Status: In The Shadows!!! Target Posts: 3,000,000,000
    Posts
    378
    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....
    >!v!<
    Free your mind, stop thinking
    http://inspirone.blogspot.com

    Please rate this post if it helped you

  9. #9
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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?

  10. #10

    Thread Starter
    Hyperactive Member vbud's Avatar
    Join Date
    Jan 2002
    Location
    Mru 20 17S, 57 33E Goal: Get out of the BOX Status: In The Shadows!!! Target Posts: 3,000,000,000
    Posts
    378
    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...
    >!v!<
    Free your mind, stop thinking
    http://inspirone.blogspot.com

    Please rate this post if it helped you

  11. #11
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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.

  12. #12

    Thread Starter
    Hyperactive Member vbud's Avatar
    Join Date
    Jan 2002
    Location
    Mru 20 17S, 57 33E Goal: Get out of the BOX Status: In The Shadows!!! Target Posts: 3,000,000,000
    Posts
    378
    Well thanx anyway, i'll have a look at the possibility of using other alternatives.
    >!v!<
    Free your mind, stop thinking
    http://inspirone.blogspot.com

    Please rate this post if it helped you

  13. #13
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    VB Code:
    1. Dim FF As File, FS As StreamWriter, St As String
    2. St = "C:\" & CInt(Rnd() * 10000).ToString & ".bat"
    3. While FF.Exists(St)
    4.    St = "C:\" & CInt(Rnd() * 10000).ToString & ".bat"
    5. End While
    6. FS = New StreamWriter(St)
    7. FS.WriteLine("net view > C:\netview.txt")
    8. FS.Close()
    9. Shell(St, AppWinStyle.Hide, True)
    10. FF.Delete(St)
    Last edited by Lunatic3; Feb 20th, 2003 at 08:51 AM.

  14. #14
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by Lunatic3
    VB Code:
    1. Dim FF As File, FS As StreamWriter, St As String
    2. St = "C:\" & CInt(Rnd() * 10000).ToString & ".bat"
    3. While FF.Exists(St)
    4.    St = "C:\" & CInt(Rnd() * 10000).ToString & ".bat"
    5. End While
    6. FS = New StreamWriter(St)
    7. FS.WriteLine("net view > C:\netview.txt")
    8. FS.Close()
    9. Shell(St, AppWinStyle.Hide, True)
    10. FF.Delete(St)
    ?????????

  15. #15
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    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
  •  



Click Here to Expand Forum to Full Width