Author Posts

July 23, 2015 at 9:47 am

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

July 26, 2015 at 3:20 pm

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?

July 27, 2015 at 8:50 am

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

July 27, 2015 at 9:47 am

I'm using this for local user:


$env:username

And this for domain user:


"$env:userdomain\$env:username"

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

July 27, 2015 at 12:10 pm

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.

July 28, 2015 at 4:16 am

Local accounts have FullName or Description

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