Take the 2-minute tour ×
Server Fault is a question and answer site for professional 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.

C:>echo %LOGONSERVER% \PUN5OPSDIRPIN01

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
add comment

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?

C#:
System.Environment.GetEnvironmentVariable ()

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

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

Java:
System.getenv("LOGONSERVER")

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

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

share|improve this answer
add comment

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.