2

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?

  • 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
10

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")

  • Well played, sir – gWaldo Aug 26 '10 at 18:28
2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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