PowerTip: Use a .NET Framework Class in PowerShell to Get User Info

Doctor Scripto

Summary: Use a .NET Framework class in Windows PowerShell to get user name and domain name information.

Hey, Scripting Guy! Question 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?

Hey, Scripting Guy! Answer Use the Name property from the GetCurrent static method of the WindowsIdentity .NET Framework class:

[System.Security.Principal.WindowsIdentity]::GetCurrent().Name

0 comments

Discussion is closed.

Feedback usabilla icon