Today I ran into this problem and after few hours of googling i came up with this. Hope this will help someone as well.
static void Main() {
string domainservername = "xxx";
string domainusername = "xxx";
string domainpassword = "xxx";
Add reference to System.DirectoryServices.dll
DirectoryContext context = new DirectoryContext(DirectoryContextType.DirectoryServer, domainservername, domainusername, domainpassword);
DomainController controller = DomainController.FindOne(context);
string domainName = controller.Domain.Name;
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment