我正在使用此代码,但我收到错误
system.directoryservices.activedirectory.directorycontext 不包含目标的定义
using System.DirectoryServices.ActiveDirectory;
static void FindAnyTimeServer(DirectoryContext context)
{
try
{
DomainController dc = DomainController.FindOne(context, LocatorOptions.TimeServerRequired);
Console.WriteLine("A time server for {0} is {1}.", context.Target, dc.Name);
}
catch (ActiveDirectoryObjectNotFoundException)
{
Console.WriteLine("No time server was found in {0}.", context.Target);
}
}