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