Results 1 to 6 of 6

Thread: netserverenum is not working in .net

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2004
    Posts
    30

    netserverenum is not working in .net

    i need to list all the server (sql server) and all the server as well / workstation ............... netserverenum is not working in dot net can you help me in this

  2. #2
    New Member
    Join Date
    Aug 2004
    Location
    Germany
    Posts
    11
    I think this Code Snippet will show you the right way.
    VB Code:
    1. Sub ListComputersOnNetwork()
    2.     ' Returns a list of all computers on the network
    3.     ' and places the results in a listview
    4.     Dim Path As String = "WinNT://RAXPHQ"
    5.    ' Edit the path to fit your domain/workgroup
    6.     Dim Domain As New System.DirectoryServices.DirectoryEntry(Path)
    7.     ' If you want to login as a specific user to get the list,
    8.     ' you could use the following constructor:
    9.     ' Dim Domain As New System.DirectoryServices.DirectoryEntry(Path, UserName, Password)
    10.  
    11.     Dim Computers As DirectoryServices.DirectoryEntries = Domain.Children
    12.     Computers.SchemaFilter.Add("Computer")
    13.  
    14.     Dim Computer As DirectoryServices.DirectoryEntry
    15.     Dim tmpItem As ListViewItem
    16.  
    17.     For Each Computer In Computers
    18.         tmpItem = ListView1.Items.Add(Computer.Name)
    19.         tmpItem.SubItems.Add(Computer.Path)
    20.     Next
    21.  
    22. End Sub

    greetz

    Cheffe0815

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 2004
    Posts
    30
    Cheffe0815

    thanks ! for the code but i have another problem in your code i can get the list of computer with the give "path" but what i need is the list of workgroups or domain / to supply it in the path can you help me with this

    thanks

  4. #4
    New Member
    Join Date
    Aug 2004
    Location
    Germany
    Posts
    11

    Wink

    Try this one
    VB Code:
    1. ' Gets a list of Domain names the user can see on the network.
    2. ' Needs a Reference to System.DirectoryServices.
    3. Public Shared Function ListDomainsInNetwork() As ArrayList
    4.     Dim networkDomains As System.DirectoryServices.DirectoryEntry = _
    5.             New System.DirectoryServices.DirectoryEntry("WinNT:")
    6.     Dim domain As System.DirectoryServices.DirectoryEntry
    7.     Dim domains As New ArrayList()
    8.  
    9.     'Populate the array with the list of domains
    10.     For Each domain In networkDomains.Children
    11.         domains.Add(domain.Name)
    12.         domain.Close()
    13.     Next
    14.  
    15.     Return domains
    16.  
    17. End Function

    greetz

    Cheffe0815

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Aug 2004
    Posts
    30
    cheffe0815

    thanks again pal !!!!

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Aug 2004
    Posts
    30

    os running

    thanks pal ! can you help me again with this one

    how can i know what operation system running in each computer list or is the computer a client or server

    thanks

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