Need a way to get the locally logged on users of a remote computer or server using PowerShell? The function listed below here could be an answer for you. Get-loggedonuser basically queries WMI on the remote computer to find out who is logged in, filters out the current user (your session), and provides output in a PowerShell friendly format that can be passed further down the pipeline.

Here’s how to use the tool.

Get-LoggedOnUser -ComputerName Test-PC01

And Voila! We get a nice list of all of the users that are logged into that computer.

Below is the code I’ve written for this purpose. If you have an existing PowerShell module library with functions for your help desk or junior admins, this might be a good addition to those modules.


The tools being developed on this blog are available on the PowerShell gallery here! This means to begin using the tool set, simply run the following command to install them.

Install-Module -Name ServerAdminCommon

If you have previously installed the toolset, you can update the tools using following command:

Update-Module -Name ServerAdminCommon

As with all of the modules on this blog, you can find this tool on my github page for the ServerAdminCommon tool set.


Disclaimer: All scripts and other powershell references on this blog are offered “as is” with no warranty. While these scripts are tested and working in my environment, it is recommended that you test these scripts in a test environment before using in your production environment.