PowerTip: Pick Up User Name with PowerShell


Summary: Use Windows PowerShell to easily pick up the user name.

Hey, Scripting Guy! Question How can I easily pick up the user name from my Windows PowerShell script?

Hey, Scripting Guy! Answer Use the USERNAME environmental variable, and pick it up from the $env Windows PowerShell drive:

$env:USERNAME

Comments (0)

Skip to main content