DEV Community

Cover image for Powershell - Get Logged On Users
Dan Wheeler
Dan Wheeler

Posted on

Powershell - Get Logged On Users

To get the names of users that are logged into a machine via Powershell, use this:

query user
Enter fullscreen mode Exit fullscreen mode

To query another machine, use this whilst replacing the #'s with the machine number that you wish to query:

query user /server:#######
Enter fullscreen mode Exit fullscreen mode

The results will show the usernames of those who are logged into the machine as well as who is currently active.

Top comments (0)