find username from active directory using ipaddress

I want to get the user name from active directory using an ip address of the machine from which the user logged in from.

I was wondering if it is possible to find the user name from Active directory or any other form?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Madison PerkinsConsultantCommented:
Please clarify.

Would you like to know who is logged into a workstation?
Would you like to know the ip address of a workstation?
Would you like to query active directory for a username?

Would you like to query a machine name, return the ipaddress, deternime the user logged into the machine and return user object information such as first name last name?
do you want to know who is logged on locally to a remote machine?
the answer is pstools.
psloggedon \\computername -l -x
psloggedon \\computername

I don't think that is directly possible since Active Directory doesn't store that information (by default).

However, depending on how your network is setup, you can try to pull the username via NetBios.

Try opening a command prompt and using NBTSTAT

"nbtstat -A IPAddress"

The line with "<03>  UNIQUE" should be the username.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Quihong is right.

Using NBTSTAT you can find out the name of who is logged in.  Of course this requires that you have netbios enabled on the systems in questions (which it is by default).
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

kiran_madalaAuthor Commented:
Thanks for all the answers. The scenario is

In a domain environment maintained by Active Directory when the user logs and if allowed to access internet then he/she is give a internet lease in which case there should be a mapping between the user logged in an the ip address.

My application is on a 3rd party server which receives the ipaddress from where the request was made. so using that ip address I need to find the user who made the request (The user who is currently logged in from that machine and using the internet).

I am not completely sure but As far as I know the AD might be updating the DNS with this info otherwise how would some one know at what time the internet was accessed by a particular user.

What is the equivalent command of NBSTAT in linux?
Did I not answer the question?
There isn't any since Linux does run netbois.
Forced accept.

EE Admin
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Legacy OS

From novice to tech pro — start learning today.