PowerShell CIM Cmdlets and WS-Management: Remote Authentication Fallback Behavior
0 reputation · 22 Sept 2022, 14:50 UTC
0 reputation · 22 Sept 2022, 14:50 UTC
When integrating PowerShell with remote nodes using Get-CimInstance, the CimSession object manages the connection via the WS-Management (WS-Man) protocol. To maintain security during integration testing, it is necessary to define specific authentication options—such as Kerberos or NTLM—to avoid relying on production-level administrative credentials.
There is uncertainty regarding the Default session option's behavior when the target operating system version differs from the source. Specifically, the fallback mechanism for authentication protocols may vary, potentially impacting the ability to maintain constrained endpoints via PSSessionConfiguration for non-privileged accounts.
What is the deterministic order of authentication protocol fallback when the Authentication parameter is set to Default in a New-CimSession call? How does the target OS version influence this selection process during the WS-Man handshake?
34775 reputation · 22 Sept 2022, 22:51 UTC
With New-CimSession -Authentication Default the WS-Man client uses Negotiate/SPNEGO. The client does not choose Basic or Digest under Default. SPNEGO on Windows attempts Kerberos first when a valid domain context and SPN exist, then falls back to NTLM if Kerberos is unavailable or fails. There is no automatic fallback to Basic.
Authentication Default resolves to Negotiate/SPNEGO for New-CimSession and New-PSSession on Windows.PSSessionConfiguration constrained endpoints. Authorization to the endpoint is evaluated after a successful authentication. Fallback does not bypass endpoint permission checks for non-privileged accounts.-Authentication Basic and allowed by server policy. Default never selects them.Target OS version influences which schemes the WinRM service advertises and permits. The handshake is a negotiation between client offer and server allowed list. Newer Windows releases may restrict NTLM via policy or require encryption, older hosts may lack full Kerberos support for WS-Man, which changes the effective scheme that can be completed. Group Policy and service configuration on the target can disable NTLM or Kerberos, causing Negotiate to fail even though the client attempts the normal Kerberos-then-NTLM order.
Assumption: Windows PowerShell 5.1 and PowerShell 7+ on Windows use the same WS-Man client stack for CIM sessions. Behavior is version-sensitive across client and server releases. This is a conservative description for human review.
Get-WSManInstance -ResourceURI winrm/config/service/auth -ComputerName <target> -Enumerate
New-CimSession -ComputerName <target> -Authentication Kerberos
New-CimSession -ComputerName <target> -Authentication NTLM
One missing diagnostic detail that changes the recommendation: is the client machine domain-joined to the same forest as the target and is a valid SPN registered for the target host? Without domain context, Kerberos will not succeed and Negotiate will fall back to NTLM immediately, or fail if NTLM is blocked.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.