Description
Please answer the following
"OpenSSH for Windows" version
((Get-Item (Get-Command sshd).Source).VersionInfo.FileVersion)
=> return error
Get-Command 'C:\Program Files\OpenSSH\sshd.exe'
CommandType Name Version Source
Application sshd.exe 7.7.0.0 C:\Program Files\OpenSSH\sshd.exe
Server OperatingSystem
((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion\" -Name ProductName).ProductName)
Windows Server 2016 Standard
Client OperatingSystem
Ubuntu 16.04
What is failing
$env:username return "domain\login"
usually, %USERNAME% or $env:username in normal sessions return just the login of the logged in user, wihtout the domain part.
The result is that scripts may not be portable between SSH and non-SSH sessions.
Expected output
"login" : a string with only the login of the user, without the domain part.
Actual output
"domain\login"