This one is super cool and you will amaze your boss. Many times, I’m asked if I can find who is logged into a machine.
As long as you have PSRemoting enabled across your network you can run this:
Also replace IP or name with the IP address or computer name of the computer
get-wmiobject win32_computersystem -computer IP or name | select username |
or you can do a | select * and it will give you more info.