Click here to Skip to main content
15,880,392 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi I need to get names of all the computers in a workgroup. Computers which are shut down must be omitted.
The following code gives the computers which are shut down in the immediate past, too.

C#
using (DirectoryEntry workgroup = new DirectoryEntry("WinNT://Workgroup"))
                {
                   
                    foreach (DirectoryEntry childEntry in workgroup.Children)
                        currentSystems.Add(childEntry.Name);
                }



Please, help me to get all the computers in a workgroup , except the shut down ones.
Posted
Comments
Zoltán Zörgő 20-Jan-15 4:36am    
Workgroup or Active directory? These are related but really different...
johnyroyan 20-Jan-15 4:37am    
Workgroup
Wastedtalent 20-Jan-15 9:08am    
Just a random thought, could you iterate through each one and see if it responds to a ping? That's really easy to do in code.
johnyroyan 20-Jan-15 9:11am    
Thank you. It is really a great idea
johnyroyan 20-Jan-15 9:29am    
Could you please post this as solution? It will help a lot of people

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