How to find out who is logged in to a network computer with PowerShell

July 9, 2017 at 4:10 PMMadestro

Here is how to figure out who is currently logged in to a network computer. This comes in handy for situations where you need to access the computer, say, via Remote Desktop connection and someone is already logged in:

 Get-WmiObject -Class win32_process -ComputerName PUT_COMPUTER_NAME_HERE | Where-Object{ $_.Name -eq "explorer.exe" } | ForEach-Object{ ($_.GetOwner()).Domain + "\\" + ($_.GetOwner()).User; }

Type that all in one line.

Posted in: Windows Networking