Talk About Network

Google





Software > ADSI General > Re: Testing if ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 6 Topic 5319 of 5437
Post > Topic >>

Re: Testing if machine is registered in AD domain

by "Rich Armstrong" <RichA24@[EMAIL PROTECTED] > Jul 8, 2008 at 11:42 AM

Thanks, Richard. The user's identity isn't an issue for me; it will always 
be either Local System or Network Service. All I care about is whether the

machine itself is joined to a domain, as its credentialls would be the
ones 
presented to AD. I did manage to dig up this, though: 
System.DirectoryServices.ActiveDirectory.Domain.GetComputerDomain(). It
may 
do the job, but I'm unsure of a couple of things:

If the computer is joined to a domain, but is running offline, the docs
say 
it will throw an exception. That's fine with me, but what sort of timeout 
might I expect, and is there a way to minimize that timeout?

If it becomes an issue, I can always just cache the (boolean) result. If
the 
machine's domain member****p changes while the app is running (highly 
unlikely), the consequences are minimal.

--Rich Armstrong


"Richard Mueller [MVP]" <rlmueller-nospam@[EMAIL PROTECTED]
> wrote in 
message news:%239CbTIR4IHA.2332@[EMAIL PROTECTED]
>
> "Rich Armstrong" <RichA24@[EMAIL PROTECTED]
> wrote in message 
> news:D076CE49-DDF8-4096-8257-1ED53934E464@[EMAIL PROTECTED]
>> With .NET, what's the quickest, reliable way of determining if the 
>> machine on which the process is running is registered in an AD domain? 
>> This seems like a simple enough task, but the solution eludes me.
>>
>> TIA...
>
> As far as I can tell, .NET has no special features for this. I attempt
to 
> bind to the ADSystemInfo object. If this fails, the user/computer are
not 
> authenicated to a domain. However, there is a timeout involved. Another 
> idea would be to retrieve the value of the userdomain environment
variable 
> and compare this to the ComputerName property of the wshNetwork object.
If 
> they match, the user is logged in locally. If they do not match, then 
> userdomain is the name of the domain. Instead of the userdomain 
> environment variable you can use the UserDomain property of the
wshNetwork 
> object, which is the same. You could also attempt to bind to the RootDSE

> object, but this would also involve a timeout if a domain is not found.
>
> -- 
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> -- 
>
>
 




 6 Posts in Topic:
Testing if machine is registered in AD domain
"Rich Armstrong"  2008-07-08 09:55:52 
Re: Testing if machine is registered in AD domain
"Richard Mueller [MV  2008-07-08 10:48:17 
Re: Testing if machine is registered in AD domain
"Rich Armstrong"  2008-07-08 11:42:42 
Re: Testing if machine is registered in AD domain
"Joe Kaplan" &l  2008-07-08 13:05:27 
Re: Testing if machine is registered in AD domain
"Richard Mueller [MV  2008-07-08 13:34:36 
Re: Testing if machine is registered in AD domain
"Rich Armstrong"  2008-07-17 07:57:45 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Thu Jan 8 20:04:39 PST 2009.