Quick-Hits: Find currently logged on users

Learn Powershell | Achieve More

I was recently tasked with locating all servers on our network and query for users that were currently logged onto each server, either through a terminal session or logged on via console session.  This got me thinking of what ways are available to make this happen.  When it was all said and done, I came up with 4 ways to do this.

The first method is to use the Win32_ComputerSystem and grab the UserName property. The thing that you keep in mind with is that this will only return the user that is logged on using a console session, meaning that they are locally logged onto the machine, not logged on via remote desktop.

Untitled

The second method involves another WMI query that will work for both console sessions and remote sessions.  This query looks at the Win32_Processclass and then performs a query to look for all of the explore.exe…

View original post 281 more words

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