Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

A host which part of Active directory domain does authentication from the logon server (domain controller).

LOGONSERVER env var has its value.


Is there any API using which I can retrieve this value?

share|improve this question
This could swing either way, on Stackoverflow or here. I would propose that we keep it here because of the usefulness in scripting sysadmin tasks. –  squillman Aug 26 '10 at 16:39

2 Answers 2

Nearly every language or framework will have a method that will let you retrive the values of environment variables. .NET, Powershell, Java... What are you coding in?

System.Environment.GetEnvironmentVariable ()

$env:<name of env variable>, so for example $env:logonserver

WMI (using VBS):
Set colItems = objWMIService.ExecQuery(”Select * from Win32_Environment”)


share|improve this answer
Well played, sir –  gWaldo Aug 26 '10 at 18:28

Assuming you want to retrieve that from the client, you could query "HKCU:\Volatile Environment\LOGONSERVER" or env:LOGONSERVER.

share|improve this answer

Your Answer


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.