We help IT Professionals succeed at work.

Check who is logged into specific IP addresses

I would like to check which user(s) are logged into a specific IP address  (internally) on a Windows network.
How can I achieve this via a script or command line?
Comment
Watch Question

IT Services Analyst
Commented:
query user /server:nameofcomputer

So if they were on a PC called PC123 it would be query user /server:PC123

Or if they IP of that machine was 10.10.25.180 then query user /server:10.10.25.180
Distinguished Expert 2019

Commented:
To have this information handy, you have to proactively collect it.

You can use a user base GPO that runs a login script
echo "On %date% at %time%, %USERNAME% loged into %COMPUTERNAME% on %sessionname% authorized against %LOGONSERVER^" >>\\server\sharename\recordkeeping_file.

Now on your DHCP server, you have to keep a record of which IP was allocated to which system.

The above is a simple example, you can use vbscript, powershell, etc. to record these in a DB.
You can use SNMP to generate login/logout events as well as IP...

Author

Commented:
Thanks William.