Summary: Use a .NET Framework class in Windows PowerShell to get user name and domain name information.
How can I use a .NET Framework class in Windows PowerShell to get a user name and domain in the format userdomain\username, without building a string?
Use the Name property from the GetCurrent static method of the WindowsIdentity .NET Framework class:
[System.Security.Principal.WindowsIdentity]::GetCurrent().Name