.Net: Getting list of network clients

G

Guest

I am designing an application that need to get list of all the client
computers on Windows network domain (in same domain on which application will
run).

how can i do this in .NET

Thanx in advance
 
G

Guest

Private Sub GetMachineNames()
cbReceiver.Items.Clear()
Dim myProcess As Process = New Process
Dim s As String
myProcess.StartInfo.FileName = "cmd.exe"
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.RedirectStandardInput = True
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.StartInfo.RedirectStandardError = True
myProcess.Start()
Dim sIn As StreamWriter = myProcess.StandardInput
sIn.AutoFlush = True

Dim sOut As StreamReader = myProcess.StandardOutput
Dim sErr As StreamReader = myProcess.StandardError


sIn.Write("net view" & System.Environment.NewLine)
sIn.Write("exit" & System.Environment.NewLine)
s = sOut.ReadToEnd

If Not myProcess.HasExited Then
myProcess.Kill()
End If
sIn.Close()
sOut.Close()
sErr.Close()
myProcess.Close()
Dim strarray() As String = s.Split(ControlChars.CrLf)
Dim strarry1 As String
Dim finalstr As String
For Each strarry1 In strarray
If strarry1.IndexOf("\\") <> -1 Then
finalstr = strarry1.Remove(1, 2)
cbReceiver.Items.Add(finalstr.Trim())
End If

Next
End Sub
 
G

Guest

I looked into the WMI classes but could not find any class that list clients
on the network.

Ramta
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top