PC Review


Reply
Thread Tools Rate Thread

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

 
 
=?Utf-8?B?R25pbHV5?=
Guest
Posts: n/a
 
      24th Nov 2004
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
 
Reply With Quote
 
 
 
 
Daniel A. Seara
Guest
Posts: n/a
 
      26th Nov 2004
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
newsA6B0C52-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



 
Reply With Quote
 
=?Utf-8?B?R25pbHV5?=
Guest
Posts: n/a
 
      27th Nov 2004
Thanks. But System.Net.Dns.GetHostByName() just return the host name without
the domain name in my test environment even though my workstation is in a
domain.

"Daniel A. Seara" wrote:

> 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
> newsA6B0C52-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

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
windows login to local domain contoller Auddog Microsoft Windows 2000 Networking 1 25th Feb 2007 11:26 AM
How to determine if the day has ended on local machine Rajat Tandon Microsoft C# .NET 2 2nd Sep 2006 02:45 PM
Domain User on local machine =?Utf-8?B?TWljaGFlbEw=?= Windows XP Setup 4 27th Mar 2006 09:04 PM
cannot add domain users on local machine Brian Roberts Microsoft Windows 2000 2 10th Sep 2003 09:21 PM
Local Machine or Domain Ron C Microsoft Windows 2000 Terminal Server Clients 0 21st Jul 2003 02:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:32 PM.