How do I detect whether the machine is joined to an Active Directory domain (versus in Workgroup mode)?
The Environment variables could work for you.
Environment.UserDomainName
MSDN Link for some more details.
Environment.GetEnvironmentVariable("USERDNSDOMAIN")
I'm not sure this environment variable exists without being in a domain.
Correct me if I'm wrong Windows Admin geeks -- I believe a computer can be in several domains so it may be more important to know what domain, if any, you are in instead of it being in any domain.