Powershell: WinRM differences (NTLM) between PowerShell-Core and PowerShell-Native?

Created on 3 Feb 2019  路  4Comments  路  Source: PowerShell/PowerShell

Hi guys, working on deprecating some Python script I've been using in favor of pwsh core. I'm simply trying to connect over WinRM with NTLM (Negotiate) as the authentication mechanism and powershell-core seems to act differently from powershell native. I'm using the docker://microsoft/powershell container to test.

There error message that powershell-core emits is:
acquiring creds with username only failed An invalid name was supplied SPNEGO cannot find mechanisms to negotiate For more information, see the about_Remote_Troubleshooting Help topic.

This message implies that the ntlm hash isn't being exchanged, but that'd be strange unless some capability is missing. So is that really the case, or is there some capability that powershell-core or maybe the hosted container is missing?

Target WS-Management version

PS C:\Users\user> Test-WSMan -ComputerName $h -Authentication Negotiate -Credential $creds

wsmid           : http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd
ProtocolVersion : http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd
ProductVendor   : Microsoft Corporation
ProductVersion  : OS: 6.2.9200 SP: 0.0 Stack: 3.0

Windows vs Windows

PS C:\Users\user> $creds = Get-Credential -UserName root

cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Message: default root password
PS C:\Users\user> $h
172.33.33.140
PS C:\Users\user> New-PSSession -ComputerName $h -Credential $creds -Authentication Negotiate | Set-Variable -Name s
PS C:\Users\user> $s

 Id Name            ComputerName    ComputerType    State         ConfigurationName    Availability
 -- ----            ------------    ------------    -----         -----------------    --------
 19 Session19       172.33.33.140   RemoteMachine   Opened        Microsoft.PowerShell ...lable

PS C:\Users\user> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.14393.2580
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.2580
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

PowerShell-Core (docker://microsoft/powershell:latest) vs Windows:

PS /> $creds = Get-Credential -UserName root

PowerShell credential request
Enter your credentials.
Password for user root: *********************

PS /> $h
172.33.33.140

PS /> Enter-PSSession -ComputerName $h -Credential $creds -Authentication Negotiate
Enter-PSSession : Connecting to remote server 172.33.33.140 failed with the following error message : acquiring creds with username only failed An invalid name was supplied SPNEGO cannot find mechanisms to negotiate For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ Enter-PSSession -ComputerName $h -Credential $creds -Authentication N ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidArgument: (172.33.33.140:String) [Enter-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : CreateRemoteRunspaceFailed

PS /> $psversiontable

Name                           Value
----                           -----
PSVersion                      6.1.2
PSEdition                      Core
GitCommitId                    6.1.2
OS                             Linux 4.14.96-coreos #1 SMP Mon Jan 28 05:16:10 -00 2019
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Issue-Question Resolution-Answered WG-Remoting

All 4 comments

Freaking awesome. Thanks. The Windows box was already configured properly. Was totally an issue with the microsoft/powershell container not supporting NTLM out of the box.

Closing since it turns out this issue is in the wrong tracker and should be in the PowerShell-Docker tracker.

Ftr, the NTLM support for the microsoft/powershell container is being resolved by PowerShell/PowerShell-Docker#124.

I'm working on adding it to the Docker images

Was this page helpful?
0 / 5 - 0 ratings