Click here to Skip to main content
15,905,322 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
I want write a program with c#.net which is similar to netsupport.

In the first laoding want have the all existing systems of network and show it in listview.

I use netapi32.dll but I don't see all existing systems of network by netapi32.dll.

In my network, systems are member of workgroup or domain with different operation systems.

Now, I want have all existing systems that those turn on.

pleas, help me :rose::rose::rose:

A small example of the program:

soft1-172.16.0.1
soft2-172.16.0.2
soft3-172.16.0.3
Posted
Comments
JF2015 29-Oct-10 14:53pm    
Why do you crosspost with a different account? This question seems to be from you too: http://www.codeproject.com/Questions/122381/List-Of-IP.aspx

Try this:
using System;
using System.Diagnostics;
using System.IO;
using System.Collections.Generic;
class Program
{
  static void Main ()
  {
    Process proc = new Process();
    proc.StartInfo.FileName = "net.exe";
    proc.StartInfo.CreateNoWindow = true;
    proc.StartInfo.Arguments = "view";
    proc.StartInfo.RedirectStandardOutput = true;
    proc.StartInfo.UseShellExecute = false;
    proc.Start();
    StreamReader sr = new StreamReader(proc.StandardOutput.BaseStream);
    string line = "";
    List<string> names = new List<string>();
    while ((line = sr.ReadLine()) != null)
    {
      if (line.StartsWith(@"\\"))
        names.Add(line.Substring(2).TrimEnd());
    }
    sr.Close();
    proc.WaitForExit();
    foreach(string name in names)
    {
      Console.WriteLine(name);
    }
    Console.ReadKey();
  }
}
 
Share this answer
 
v2
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900