views:

9

answers:

1

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?

A: 

The best way to get the information is LsaGetLogonSessionData API which allocate and return back SECURITY_LOGON_SESSION_DATA structure contains LogonServer field. The input parameter LUID LogonId you can get from GetTokenInformation which you should call with the TokenInformationClass parameter set to TokenStatistics. The field AuthenticationId the TOKEN_STATISTICS struct is the LUID which one need to use.

In the answer http://stackoverflow.com/questions/3371807/get-current-users-last-logon I posted an code example which shows how to get this and some other information about the current login session.

Oleg