Does anyone have a script that I can run to show where a particular domain user is logged onto?
They are constantly being locked out in AD and I want to see what is causing this.
Thanks in advance,
This is a common request and there are lots of articles and sample scripts available. Just use your favorite search engine and search using something like 'PowerShell monitor domain login'.
This will give you results links like the below and more. Even one dealing with your specific use case.
Login monitoringConnects to a security log and retrieves successful login events and returns time, user, and type of loginhttps://gallery.technet.microsoft.com/ScriptCenter/dd90d04f-5de5-4cf2-ad50-187701f3196c/
Track user logons with a PowerShell scripthttps://4sysops.com/archives/track-user-logons-with-a-powershell-script
Use PowerShell to log logon and logoff activity on domain computershttps://www.jasonpearce.com/2016/12/26/use-powershell-to-log-logon-and-logoff-activity-on-domain-computers
Use PowerShell to Find the Location of a Locked-Out Userhttps://blogs.technet.microsoft.com/heyscriptingguy/2012/12/27/use-powershell-to-find-the-location-of-a-locked-out-user