Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you find out the difference between workstations and servers on the network?

I know how to get the machines on a server using the System.DirectoryServices network. The issue is that I would like to ignore workstations/computers on the network and only retrieve servers.

In case someone says to check the OS version, the problem with getting a Win NT family OS version number is that each number may correspond to both a server and non-server OS (such as NT version 6.1 referring both to Win 7 and Win Server 2008 R2).

Here is my basic test class:

namespace Project1
{
    class Class1
    {
        public static void Main(string[] args)
        {
             List<string> list = Class1.GetComputersOnNetwork();           
        }

        public static List<string> GetComputersOnNetwork()
        {
            string fileName = "networkcomputers.txt";  

            // Delete the file if it exists.
            if (System.IO.File.Exists(fileName))
            {
                System.IO.File.Delete(fileName);
            }

            // Create the file.
            System.IO.FileStream fs = System.IO.File.Create(fileName, 1024);

            StreamWriter strwr = new StreamWriter(fs);

            int i = 0;
            List<string> list = new List<string>();
            DirectoryEntry root = new DirectoryEntry("WinNT:");           
            foreach (DirectoryEntry computers in root.Children)
            {                   
                if ((computers.Name != "Schema"))
                {
                    i++;
                    Console.WriteLine("Machine Number " + i + ": " + computers.Name);
                    strwr.WriteLine("Machine Number " + i + ": " + computers.Name);
                    list.Add(computers.Name);
                }           
            }
            return list;
        }
    }
}
like image 611
praetor Avatar asked Jul 25 '12 17:07

praetor


People also ask

How do you differentiate between server and workstation?

Function: Servers are software and hardware that store data, manage network resources, and fulfill client requests. Workstations are laptops and PCs that quickly perform complex, technical tasks such as digital content creation and detailed analysis.

What is a workstation in a network?

They're simply personal computers attached to a local area network (LAN) that in turn shares the resources of one or more large computers. Since they are PCs, they can also be used independently of the mainframe assuming they have their own applications installed and their own hard disk storage.

Can you use a workstation as a server?

Its okay to use workstations as servers, but you generally get what you pay for. Also, make sure you 'server class' processor is actually supported by the motherboard. Show activity on this post. Usually from manufacturers like dell, Server class hardware comes with management utilities, etc.

What is the difference between workstation and client?

Client Computer: A personal computer in networking that connects to the server and uses the network services to perform user's tasks is a client computer. Workstation: A workstation is a node in networking that is more powerful and can handle local information processing or graphics processing.


1 Answers

Instead of going at the operatingSystemVersion property, look at the operatingSystem property. That'll give you the name of the SKU. You'll need to know which are server OS versions and which aren't - there's no IsServer boolean. Depending on how they're named, you may be able to do a wildcard search on operatingSystemVersion to find computers that have a operatingSystemVersion that contains the string "server".

like image 58
MNGwinn Avatar answered Oct 13 '22 10:10

MNGwinn