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


|