Local Logged In User

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

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?

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

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

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.

Local accounts have FullName or Description

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