How do I find a user name who logged on to the workstation?

Posted on 2009-02-10
Last Modified: 2012-05-06
How do I find a user name who is logged on to the workstationwith knowen Ip address and a computer name
Question by:PeterGbiorczyk
    LVL 82

    Assisted Solution

    Try Sysinternals PsLoggedOn (
    psloggedon \\ComputerName
    LVL 70

    Accepted Solution


    There are a few different ways.

    On the simple level you can connect to the Administrative share (C$), then sort the contents of "Documents and Settings" by date modified.

    Or you can use WMI and get the value of UserName from Win32_ComputerSystem. VbScript and PowerShell examples of that below.

    ' VbScript example
    strComputer = "The IP"
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colItems = objWMIService.ExecQuery("SELECT UserName FROM Win32_ComputerSystem")
    For Each objItem in colItems
      WScript.Echo objItem.UserName
    # PowerShell example
    (Get-WMIObject Win32_ComputerSystem -Computer "The IP").UserName

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    One of the major disadvantages of still running XP in production is its lack of Internet Explorer Favourites directory redirection. If your users frequently roam between computers, the usual workaround is to enable Roaming Profiles to have the favou…
    Companies that have implemented Microsoft’s Active Directory need to ensure that the Active Directory is configured and operating properly. If there are issues found and not resolved, it eventually leads the components to fail or stop working and fi…
    This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
    This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now