When in a domain, a machine’s name is limited to 15 characters, but in a workgroup a machine name can be much longer. However, as one of our internal customers noticed, Environment.MachineName truncates after the first 15 characters.  This is because Environment.ComputerName maps to NetBIOS name of the local computer and not the DNS host name. NetBIOS name is limited to MAX_COMPUTERNAME_LENGTH which is 15 for Windows (refer to winbase.h).


You might want to look into Dns.GetHostByName or P/Invoke to GetHostNameEx for more flexibility.