How do I get the current logged in Active Directory username from VBA?

后端 未结 4 1451
南旧
南旧 2021-01-22 05:38

I am new to Active Directory.

I have a VBA Excel Add-In that should run if, and only if, the computer that it is running on is currently logged into the Active Directory

4条回答
  •  遇见更好的自我
    2021-01-22 06:04

    EDITED: If I understand your situation properly, then you might be going about this the wrong way.

    When your app starts up, you could do a simple ping against a machine that the user would only be able to see if they were connected to your network, whether they log into the local network or if they are connected via the VPN.

    If they already have access to your local network, it means they've already authenticated against whatever machanism, whether it's Active Directory or something else, and it means they are "currently logged in".

    On a side note, Active Directory by itself doesn't know if someone is logged in. There's no way you can do something like:

    ActiveDirectory.getIsThisUserLoggedIn("username");
    

    Active Directory only acts as a mechanism for user metadata, security, and authentication.

提交回复
热议问题