Re: How to determine whether the local machine is a domain contoller?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Daniel A. Seara (dsearaNOLALEO_at_hotmail.com)
Date: 11/26/04


Date: Fri, 26 Nov 2004 13:26:07 -0300

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" <Gniluy@discussions.microsoft.com> escribió en el mensaje
news:DA6B0C52-6242-4F41-B256-1ABAFC510915@microsoft.com...
> 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



Relevant Pages

  • Re: Working FAQ/rules anywhere?
    ... > The domain name configured to this hostname has expired. ... > If this domain name belongs to you, ... The new world epitaph... ... Prev by Date: ...
    (uk.rec.motorcycles)
  • Re: How to find out if running on a domain controller
    ... You can use code from the above article to enumerate DC's and then check if ... it matches the hostname of the machine you are installing on. ... > whether it's running on a domain controller so I can give a warning to ...
    (microsoft.public.dotnet.framework)
  • Re: HELP Sendmail is rewriting my FROM/TO/REPLY-TO headers (Debian)
    ... local non-profit and I wouldn't want it reflected in usenet history ... My hostname: secure.domain.com ... ... Don't use an actual domain that belongs to someone else. ...
    (comp.mail.sendmail)