Get the Machine Name the User Last Logged on to
Keywords: computer name last logged on in
Question:
Is there a way in WinBatch to get the computername of a user, only knowing the user's userid, provided they have logged
into the domain. Or is there a NT Reskit utility that can do that?
Answer:
Not sure if it'll work or not, but if you're a Domain Admins user, you can query all DCs for connected sessions and from
there you should be able to locate the machine name:
- Use SYSINTERNALS.COM's PSEXEC.EXE util. to run NET SESSION remotely on all DCs (using a batch file) - NET SESSION
returns the computername, username, open files, etc. info. for machines attaching to the server
- The batch file will redirect the NET SESSION output to a file
- You can then collect all these files and you should be able to locate the workstation the user is using
Or you can (somehow) query the WINS database for the info.
User Reply:
Thanks, for the info. I found another neat utility online called NTNAME.exe. Basically given the userid as a
parameter, it grabs the machine name the user last logged on to. You can then output that info to a txt file and
read it from there. Much easier and simpler than querying the WINS database or running NET SESSION on all DCs.
Article ID: W15528
File Created: 2003:05:13:11:28:30
Last Updated: 2003:05:13:11:28:30