Powershell – How to find last login user on given computer name on AD

active-directorypowershell

If anyone could help, it would be appreciated. I am trying to audit the network. I have list of computers that are active in last 3 months in domain. I have little script that run when user login to the computer and writes the file with computer name. I have 39 computers and only on 23 computers the script was run. So I am chasing up with other 16 computers. My question is how can I find out who has last login to the given computer name?

Many thanks in advance

Best Answer

Look in the Security Event Log on those machines. There will be all logon events audited there.

You can filter the logs for event 528. The logon type that you're looking for in those events is 2, which is an interactive logon.