Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you get Domain Name 1

Status
Not open for further replies.

debeasl1

Programmer
Jul 22, 2009
2
US
I know sys(0) and id() will return the name of the computer you run them on, but I want to get the name of the domain the computer is member of. Does anyone know how to do this?
 
look into Getenv(), eg GetEnv("USERDOMAIN"). There are some other environment variables as well.

Bye, Olaf.
 
The default domain is in the registry on this key:

SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

DefaultDomainName



Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
Thanks,

GetEnv("USERDOMAIN") worked perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top