Get-LoggedOnUser -ComputerName to all computers

Noam Atias 1 Reputation point
2021-08-15T06:50:41.193+00:00

Hi, I need to check which user is connected to which computer according to Active Directory,
I found the command Get-LoggedOnUser but I can not get all the data I need for all the computers in the organization, does anyone know a script that can get it out for me quickly?

Thank you,
Noam

Windows for business Windows Client for IT Pros Directory services Active Directory
Windows for business Windows Server User experience PowerShell
{count} votes

1 answer

Sort by: Most helpful
  1. Teusner, David 0 Reputation points
    2024-08-16T15:29:15.08+00:00

    I had the same problem but found a somewhat awkward solution. Instead of querying the users directly, I first check for sessions. Then I check whether there uis a session whose sessionname begins with "rdp-tcp#' or is simply empty.

    If so, it means that there is at least one loggedon user. After that I query for all users on the same server. If there is no such hit, I simply return a differnt value.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.