|
-
Aug 23rd, 2004, 03:32 PM
#1
Thread Starter
Junior Member
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
-
Aug 26th, 2004, 03:07 PM
#2
New Member
I think this Code Snippet will show you the right way.
VB Code:
Sub ListComputersOnNetwork()
' Returns a list of all computers on the network
' and places the results in a listview
Dim Path As String = "WinNT://RAXPHQ"
' Edit the path to fit your domain/workgroup
Dim Domain As New System.DirectoryServices.DirectoryEntry(Path)
' If you want to login as a specific user to get the list,
' you could use the following constructor:
' Dim Domain As New System.DirectoryServices.DirectoryEntry(Path, UserName, Password)
Dim Computers As DirectoryServices.DirectoryEntries = Domain.Children
Computers.SchemaFilter.Add("Computer")
Dim Computer As DirectoryServices.DirectoryEntry
Dim tmpItem As ListViewItem
For Each Computer In Computers
tmpItem = ListView1.Items.Add(Computer.Name)
tmpItem.SubItems.Add(Computer.Path)
Next
End Sub
greetz
Cheffe0815
-
Aug 30th, 2004, 03:14 PM
#3
Thread Starter
Junior Member
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
-
Aug 30th, 2004, 05:19 PM
#4
New Member
Try this one
VB Code:
' Gets a list of Domain names the user can see on the network.
' Needs a Reference to System.DirectoryServices.
Public Shared Function ListDomainsInNetwork() As ArrayList
Dim networkDomains As System.DirectoryServices.DirectoryEntry = _
New System.DirectoryServices.DirectoryEntry("WinNT:")
Dim domain As System.DirectoryServices.DirectoryEntry
Dim domains As New ArrayList()
'Populate the array with the list of domains
For Each domain In networkDomains.Children
domains.Add(domain.Name)
domain.Close()
Next
Return domains
End Function
greetz
Cheffe0815
-
Sep 1st, 2004, 05:05 PM
#5
Thread Starter
Junior Member
cheffe0815
thanks again pal !!!!
-
Sep 5th, 2004, 10:41 AM
#6
Thread Starter
Junior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|