Local Logged In User


This topic contains 5 replies, has 5 voices, and was last updated by Profile photo of Max Kozlov Max Kozlov 1 year, 2 months ago.

  • Author
  • #27810
    Profile photo of Tim Fox
    Tim Fox

    I'm trying to come up with a way to get a display or friendly name for a local user logged into their PC.

  • #27895
    Profile photo of Bob McCoy
    Bob McCoy

    Can you give a little more information on what you're ultimately trying to accomplish? Are you trying to create a "Hello Tim" message? Are these accounts local to the machine, or are they domain accounts?

  • #27919
    Profile photo of Marcwake

    This has been working for me
    Get-WmiObject -class "win32_computersystem" -namespace "root\CimV2" -ComputerName $ComputerName | Select username

  • #27928
    Profile photo of Vandrey Trindade
    Vandrey Trindade

    I'm using this for local user:


    And this for domain user:


    And I want to know what do you want to achieve too =p

  • #27931
    Profile photo of Bob McCoy
    Bob McCoy

    And while both of those will give a user name, I wanted to know more about Tim's intention. If he's interested in local accounts, there really is no concept of a display name or friendly name in the LSA.

  • #27945
    Profile photo of Max Kozlov
    Max Kozlov

    Local accounts have FullName or Description

    $u = [adsi]"WinNT://$env:Computername/Administrator"

You must be logged in to reply to this topic.