I would like to be able to audit our domain and find all machines that a particular user is logged into. Does anyone have a way to do this with PowerShell?
I would like to be able to audit our domain and find all machines that a particular user is logged into. Does anyone have a way to do this with PowerShell?
(Courtesy of PeetersOnline via a search for "Powershell logged in users")
I don't have the code handy anymore, but I had done something similar in VBScript by looking at the Terminal Services Sessions. Being VBScript and not having access to the .NET frameworks, I had to do a hack to get there. (I think I looked at session IDs of explorer.exe...)
Powershell has access to the .NET frameworks, so you could look in MSDN for Terminal Services for assistance.
This is a script I use to generate an Excel sheet for every PC on a domain and who is currently logged on. Save it to a .ps1 file and run it after putting in the OU path to search. I copied most of this from somewhere off the net a long time ago.