0

I need to retrieve the displayname / full name of the user currently logged in on the computer. Is there anyway to do this without using AD?

Colour
  • 69
  • 1
  • 7
  • 1
    Please take a look at this [thread ("How to get current username in Windows Powershell?")](http://stackoverflow.com/questions/2085744/how-to-get-current-username-in-windows-powershell). – Can Bilgin Nov 24 '15 at 11:18
  • @CanBilgin This only gives me the name of the computer instead of the name displayed when I open Start Menu. – Colour Nov 24 '15 at 11:19
  • Like the Full Names I get from the command: Get-WmiObject -Class Win32_UserAccount. Although I want the current users full name :) – Colour Nov 24 '15 at 11:24
  • @Colour: Don't just look at the first answer. E.g. `[System.Security.Principal.WindowsIdentity]::GetCurrent().Name` will return what you want. – Joey Nov 24 '15 at 11:32
  • @Joey This command still only gives me the name of the computer :). – Colour Nov 25 '15 at 22:51

1 Answers1

0

whoami provides that. It's not a PowerShell cmdlet, but should still suffice.

Joey
  • 344,408
  • 85
  • 689
  • 683