Q: how to get Machine (not user)'s Domain?

  • Thread starter Thread starter Sunny Gulati
  • Start date Start date
S

Sunny Gulati

Namespace: System.Environment?

Greetings,

I am attempting to discover the domain name that the current machine belongs
to.
In this case, the code runs from "sheduled tasks" as the local
administrator, and thus System.Environment.UserDomainName returns the
machine name rather than the machine's domain name.
Is there any way to do this? if not in .Net, is there a Win32 call that can
help me with this that I could interop with?

Sincerely,
Sunny Gulati
 
no, because this pertains to the domain of a particular network credential
of a particular user. When I get the currently running user's credentials,
it gives back the same value as System.Environment.UserDomainName.
 
Sunny said:
no, because this pertains to the domain of a particular network credential
of a particular user. When I get the currently running user's credentials,
it gives back the same value as System.Environment.UserDomainName.
"Win32_NTDomain" from WMI has this information. But, that would be for
XP only.. i think.
And "Win32_NetworkAdapterConfiguration" has DNSDomain.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top