There gotta be a good way to get this done, It's surprising there's none. I've scanned through internet and located, like, 20 different techniques to locate by which domain current user is, but none of them to obtain domain (or workgroup) of current machine.
In unmanaged c++ this really is retrieved by:
WKSTA_INFO_100 *buf NetWkstaGetInfo(NULL, 100, (LPBYTE*)buf) domain_title = pBuf->wki100_langroup
can someone assist me to, if there's a method to get same info in handled C# natively?
EDIT1: Folks, please browse the question. I'm not searching for user domain title.
To find the current domain from the system which your progam is running you should use System.DirectoryServices.ActiveDirectory.Domain.
Domain domain = Domain.GetCurrentDomain() Console.WriteLine( domain.Title )
If you won't want to give a dependency to System.DirectoryServices, you may also call the NetGetJoinInformation API directly.
Read this website:
you are able to take that class making a dll file from it, and employ it inside your program.