Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

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

$
0
0

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


Viewing all articles
Browse latest Browse all 3333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>