C#.NET: Retrieve list of computers in a FOLDER in a domain -
How do I get a list of computers in a folder in a domain? I can say that my domain has Madmen.dom and I have a folder with some computers.
The following code can help you to list computers in your domain and Active Directory
// ActiveDirectorySearch1 // shows all computer names in an Active Directory using the system; Using System.DirectoryServices; Namespace ActiveDirectorySearch1 {class Class1} {Static void main (string [] args) Note: My domain name for testing Microsoft Purposes is DirectoryEntry entry = New DirectoryInterior (LDAP: //Microsoft); DirectorySearcher mySearcher = New Directory Finder (Entry); MySearcher.Filter = ("(objectClass = Computer)"); Console "Written" ("Computer List in Active Directory"); Console.WriteLine ("===========================================" ); Search (ResEnt ResEnt) in Foreach (MySearcher.FindAll) {Console.WriteLine (resEnt.GetDirectoryEntry) Name.ToString ()); } Console. WrightLine ("======================="); }}}
Comments
Post a Comment