pdomain - display name of principal domain
pdomain
The pdomain(1) utility retrieves the name of the computer's principal domain using the getpdomain(2) call, and prints it on standard output. It is useful in scripts.
On Windows, a user's full login name consists of a domain name plus a user name. Any user names presented without a domain name are assumed to belong to the principal domain. For example, if the principal domain is SERVICES, the user SERVICES+dana is displayed as dana. On input, the name dana is taken as synonymous with SERVICES+dana.
A user named dana in a different domain is still displayed in the canonical form, such as DEV+dana. If your principal domain is SERVICES and you need to refer to the user DEV+dana, the canonical name still works.
The pdomain(1) utility exits with status 0 for success, and >0 if an error occurred.
getpdomain(2)