Thomas Bratt Thomas Bratt - 4 months ago 11
PowerShell Question

How to get current username in Windows Powershell?

How to get the current username in Windows Powershell?

Answer

Found it:

[Environment]::UserName

There is also:

[Environment]::UserDomainName
[Environment]::MachineName