I've read about getting it with the Environment class, but can't find it.
Thanks guys.
You can do this with WMI; add a reference to System.Management.dll and a using statement for System.Management namespace, then call the following code:
ManagementObjectSearcher mos = new ManagementObjectSearcher(@"root\CIMV2", @"SELECT * FROM Win32_ComputerSystem"); foreach (ManagementObject mo in mos.Get()) { Console.WriteLine(mo["Workgroup"]); }