Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am writing a script and want to check whether the user is currently logged into the local machine or to the windows domain. I specifically want to get the name of the domain, as the script may be used on multiple domains and multiple workstations.

share|improve this question
up vote 1 down vote accepted

I guess you could use the Registry Functions on HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Domain to grab the name.

share|improve this answer
1  
Perfect! One caveat: the registry value for Domain is empty if logged on to the local machine, so I just had to check for that case and use the built-in A_ComputerName variable. – mwolfe02 Jan 5 '10 at 16:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.