How to find the computer name a user logged on to

Solution 1:

There is a great Sysinternals utility that will do just this for you - PsLoggedOn

Solution 2:

A cheap trick I often use is to look at the the "Sessions" listed under "Shared Folders" in the "Computer Management" console targeted at a file server computer where I know the subject user will have a "drive" "mapped".

Solution 3:

how about these in bat file as a user logon script Run it and you will see the fun

mkdir %username% 
pushd %username% 
net config workstation > %computername%.txt

OR if you need in detail

mkdir %username% 
pushd %username% 
@echo off
echo
echo I am logged on as %UserName%. >> %username%\%computername%.txt
echo My computer's name is %ComputerName%. >> %computername%.txt
echo %Date% >> %computername%.txt
echo %Time% >> %computername%.txt
echo My IP settings are >> %computername%.txt
ipconfig | find "." | find /i /v "suffix" >> %computername%.txt
getmac >> %computername%.txt
echo\

you can contact me for more scripts if you need it, its good learning for me aswell