Page 1 of 1

find the computer user last login

Posted: Tue Apr 26, 2011 5:39 am
by cymba
Hi Jay,

wonder if you can help me?
I have a list of users I want to find the last time they logged in and the computer that was login to. i wonder if you have a powershell script that facilitate this?

Thanks in advance.

find the computer user last login

Posted: Tue Apr 26, 2011 5:39 am
by cymba
Hi Jay,

wonder if you can help me?
I have a list of users I want to find the last time they logged in and the computer that was login to. i wonder if you have a powershell script that facilitate this?

Thanks in advance.

find the computer user last login

Posted: Tue Apr 26, 2011 6:04 am
by jvierra
In a domain the last logn time is held on the domain controllers. Just how toretrieve this depends on the level of the domain.

To find the machine lofgged into you would need to scan the Event log of the DC to find the login event then parse the record to obtain the machine name. This is also subject to domain configuration.

With Vista and later we can use Get-WinEvent. WIth earlier OS versions WMI is probably the best approach.

Look in the script sharing section for examples of reading the event log.