How do I detect whether the machine is joined to an Active Directory domain (versus in Workgroup mode)?
The proposed solution above returns false on a domain machine if a local user is logged in.
The most reliable method i have found is via WMI:
http://msdn.microsoft.com/en-us/library/aa394102(v=vs.85).aspx (see domainrole)