开发者

How to get logonserver name in AD domain programatically

开发者 https://www.devze.com 2023-01-13 00:41 出处:网络
A host which part of Active directory domain does authentication from the logon server (domain controller).

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

LOGONSE开发者_StackOverflow社区RVER env var has its value.

C:>echo %LOGONSERVER% \PUN5OPSDIRPIN01

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


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 Get current user's last logon I posted an code example which shows how to get this and some other information about the current login session.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号