I am trying to get domain name using C# with the below code,
static void Main(string[] args)
{
var domainName = IPGlobalProperties.GetIPGlobalProperties().DomainName;
Console.WriteLine(domainName);
Console.ReadLine();
}
It prints domain name correctly in domain connected windows 8 machine. But it doesn't print anything in windows server 2012 R2 machine.
How to get domain name in Windows server 2012 machine.