I have an issue where I have a list of AD usernames (retrieved from a server log - representing colleagues who are using software they shouldn't be at the time), but I need a way of looking up (from AD) what their email address (or full name, if email is not possible/reliable), so that I or others can contact those users to ask them to stop.
The tool I have already, that gathers the list of usernames from the server logs, is in Excel (thus VBA), so I ideally need a solution that works from VBA as well. Essentially, is there any way to pass an arbitrary AD username (NOT the current user) and return either the FullName or Email from AD? Obviously it is fairly simple if I want to retrieve the email of the current user, but that is not the question I have asked (I say this purely because there are LOTS of forum threads on retrieving Current User info from AD).
Finally, I suspect this should be possible in principle, because it is trivial to do in Python using win32net.NetUserGetInfo - so the underlying API must be there, I just don't know how to call it from VBA.
Edit: I can achieve essentially what I need in CMD as well, with the line:
net user %userid% /DOMAIN | find /I "Full name"
Thus is it possible to call the above line of CMD from within VBA (without high risk of corporate antivirus blocking it, because this has happened before when actually spawning hidden CMD shells from VBA)?