C # .NET: получить список компьютеров в папке в домене - PullRequest
0 голосов
/ 15 июня 2010

Как получить список компьютеров в ПАПЕ в домене.Допустим, у меня есть maydomain.dom в качестве домена, и у меня есть папка с несколькими компьютерами.

Ответы [ 2 ]

1 голос
/ 15 июня 2010

Это не совсем то же самое, но, возможно, вы можете использовать тот же принцип, что и в этом сообщении в блоге: Поиск пользователей в папке Active Directory с использованием GUID

1 голос
/ 15 июня 2010

Следующий код для перечисления компьютеров в вашем домене и в активном каталоге, вам может помочь

//ActiveDirectorySearch1
//Displays all computer names in an Active Directory
using System;
using System.DirectoryServices; 
namespace ActiveDirectorySearch1
{
class Class1
{
static void Main (string[] args)
{
//Note : microsoft is the name of my domain for testing purposes.
DirectoryEntry entry = new DirectoryEntry(LDAP://microsoft);
DirectorySearcher mySearcher = new DirectorySearcher(entry);
mySearcher.Filter = ("(objectClass=computer)");
Console.WriteLine("Listing of computers in the Active Directory"); 
Console.WriteLine("============================================"); foreach(SearchResult resEnt in mySearcher.FindAll())
{ 
Console.WriteLine(resEnt.GetDirectoryEntry().Name.ToString()); }
Console.WriteLine("=========== End of Listing ============="); 
}
}
}

http://www.c -sharpcorner.com / UploadFile / jodonnell / ListAllComps07022005005654AM / ListAllComps.aspx

...