Navigation Menu

Tuesday, 15 April 2014

Get List of Network Computer Names in C#

Description:

In this article, I am going write C# code to Get List of Network Computer Names using NetServerEnum API function and Get List of Active Directory based Network Computer Names in C# using DirectoryService.

Summary:

Get List of Computer Names in current Network using C#

You can easily list all the available computers in current network by using NetServerEnum API function. NetServerEnum function lists all servers of the specified type that are visible in a domain. You can specify what type of computers should be return in the results by using the parameter servertype. You can refer this article http://msdn.microsoft.com/en-us/library/windows/desktop/aa370623(v=vs.85).aspx to know about the structure of NetServerEnum and possible enum values of servertype.

Note: If your network uses Active Directory to authenticate , the Computer Browser Windows service must be running to get computers in Active Directory domain network.