Skip to content
⌘ NSIS Forum Archive

how to get user's domain

4 posts

nsfis#

how to get user's domain

Does anyone know how to get user's domain? I mean Windows domain, not internet domain.

Thank you
zimsms#
Hello NSFIS,

You can obtain the value, by obtaining and manipulating the data from the following command. Just run it in a dos box. Should work on any version of Windows.

c:\>net config workstation

It will return something similar to:

Computer name \\ZIMSMSXP
Full Computer name ZIMSMSXP.MyDomain.acme.com
User name ZIMSMS
Workstation active on
NetbiosSmb (000000000000)
NetBT_Tcpip_{GUID} (ID)

Software version Windows 2002

Workstation domain MyDomain
Workstation Domain DNS Name MyDomain.acme.com
Logon domain MyDomain

COM Open Timeout (sec) 0
COM Send Count (byte) 16
COM Send Timeout (msec) 250
The command completed successfully.

Obviously the value you want to obtain is "Workstation Domain".

Cheers,

zimsms
nsfis#
zimsms,

thank you for your tip, but this method is language dependent - international Windows versions provide this listing in different languages.

I searched the registry and found my domain in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultDomainName, but I am not sure if it is the right way.
zimsms#
Ahh, I forgot about those pesky language issues, with shell commands. That key should work, as long as, every OS has that key.