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.
 
Back
Top