Skip to content

Invoke-Command : Windows Principal functionality is not supported on this platform. #6435

@corretge

Description

@corretge

Sometimes, When I try to execute a remote command in a PowerShell Session from PowerShell in Linux, I get this error:

Invoke-Command : Windows Principal functionality is not supported on this platform.

From PowerShell in Mac works fine, but with PowerShell in Linux doesn't.

Steps to reproduce

We are connected to a Linux powershell session though a PowerShell session in a system with sshd Subsystem powershell /usr/bin/pwsh -sshs -NoLogo -NoProfile.
Once into the system, we want to execute a command to another Linux powershell session

$pss = New-PSSession -Hostname x.x.x.x -Username xxx -Port xx -KeyFilePath ~/.ssh/xxx
Invoke-Command $pss { $PSVersionTable }

Expected behavior

Name                           Value
----                           -----
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
Platform                       Unix
OS                             Linux 3.10.0-693.5.2.el7.x86_64 #1 SMP Fri Oct 20 20:32:50 UTC 2017
PSVersion                      6.0.1
PSEdition                      Core
GitCommitId                    v6.0.1

Actual behavior

Invoke-Command : Windows Principal functionality is not supported on this platform.
At line:1 char:1
+ Invoke-Command $pss { $PSVersionTable }
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Invoke-Command], PlatformNotSupportedException
+ FullyQualifiedErrorId : System.PlatformNotSupportedException,Microsoft.PowerShell.Commands.InvokeCommandCommand

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      6.0.2
PSEdition                      Core
GitCommitId                    v6.0.2
OS                             Linux 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

But if I execute Enter-PSSession I get an error, and then Invoke-Command runs like a charm.
powershell linux issues

If we connect to the linux machine though ssh with bash, and execute /usr/bin/pwsh Invoke-Command works at first attempt.

Metadata

Metadata

Assignees

Labels

Issue-BugIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions