July 7th, 2015

PowerTip: Pick Up User Name with PowerShell

Doctor Scripto
Scripter

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

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.

Feedback