.Net: Getting list of network clients

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
I looked into the WMI classes but could not find any class that list clients
on the network.

Ramta
 
Back
Top