How to get domain alias using System.DirectoryServices.ActiveDirectory.Domain class
问题 We have a domain with full name, e.g. long-domainname.com ; this domain name is replaced with alias short . this alias can be retrieved using netapi32.dll , like this: [DllImport("Netapi32.dll")] static extern int NetApiBufferFree(IntPtr Buffer); // Returns the domain name the computer is joined to, or "" if not joined. public static string GetJoinedDomain() { int result = 0; string domain = null; IntPtr pDomain = IntPtr.Zero; NetJoinStatus status = NetJoinStatus.NetSetupUnknownStatus; try {