PowerShell: Get logged on user remotely

Ever need to determine who is logged in to a remote computer?  I found myself frequently using the Sysinternals “psloggedon” utility.  Nothing wrong with this utility and it continues to work on modern OS’s however a single line of PowerShell code can accomplish the same task: (Of course this command requires administrative rights on the remote computer.  ;-))

Get-WmiObject Win32_ComputerSystem -ComputerName ComputerName | select username

LoggedOn

 

Check out the Sysinternal TechNet site.  Still some handy tools:  http://technet.microsoft.com/en-us/sysinternals/

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s