Question Locked

Scripting windows, last PC /Workstation user logged onto

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi,

Is there a way, ADSI or WMI, to find out what workstation a user last logged into?

I know how to find out who was the last user who logged into a workstation by querying Win32_Computer but I cannot do the reverse.

For example, all I have is the username jbloggs and I need to know which PC is is either currently logged onto or last logged onto.

Currently we use an antiquated application called nping which queries the Wins database but this is unrelaible. If anyone can shed some light, I don't even mind using a 3rd party command application to retrieve it (as long as it is free).

-Chris

4 replies

by lowlands

Unfortunately, this doesn't get stored anywhere in AD. Not the workstation name or the IP address, so you're out of luck there.
If you still use WINS, you're right, you might be able to make use of that info. However, the username will only get registered in WINS if the workstation/server the user logs in to also runs either the alerter or messenger service (can't remember for sure which of the two).
And one other option would be to query the workstations themselves. This would get a little involved, since you would have to query each workstation for each user id and then somehow determine which one was the last one logged on to.

I don't know of any 3rd party tools that do this either.

by toivo talikka

You can save the name of the workstation in a logon script with date, time and the login name to a text file in the server. Make sure you append, not overwrite:

echo %computername% %username% %date% %time% >> %homedrive%\%homepath%\log\log.txt

by cdargent

Thanks for the reply, I am trying not to use login scripts or the likes of that. It might have to be done in the future for the 3500 PCs but right now just trying to figure out a way to replace this NPING rubbish.

Many thanks though

This discussion is closed to new replies.