Maybe you can use something like this:
System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName).HostName.IndexOf(".")
Normally, the machines not linked to a domain has no "." in its hostname
(but I don't ensure it totally).
HTH
Daniel Seara
"Gniluy" <(E-Mail Removed)> escribió en el mensaje
news

A6B0C52-6242-4F41-B256-(E-Mail Removed)...
> I'm writing a program which needs to determine whether the local machine
> is a
> domain contoller or not. The steps I plan to do is:
> 1. Find out the local machine's name and domain name it belongs to.
> 2. Use System.DirectoryService to check whether the local machine is the
> domain controller.
>
> Question 1:
> Is this the right way to do it? In other words, Is there a better/easier
> way to do it?
>
> Question 2:
> How do I get the local machine's name and domain name? I can not use
> System.Environment.UserDomainName to get the domain name because user may
> use
> local account to login.
>
> Thanks a lot,
> Gniluy