GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Invoke-Command : Windows Principal functionality is not supported on this platform. · Issue #6435 · PowerShell/PowerShell

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

New issue
Copy link
New issue
Copy link
Closed
Closed
Invoke-Command : Windows Principal functionality is not supported on this platform.#6435
Copy link
Assignees
SteveL-MSFT
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.

Description

@corretge
Àlex Corretgé (corretge)
opened on Mar 20, 2018
Issue body actions

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.

Activity

  1. PaulHigin commented on Mar 22, 2018

    @PaulHigin
    Paul Higinbotham (PaulHigin)
    on Mar 22, 2018
    Contributor
    More actions

    This looks like a weird double hop issue. I'll try to repro when I get some time.

    Reacted by Àlex Corretgé
  2. Travis Plunk (TravisEz13)
    added
    Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the product
    on Apr 6, 2018
  3. flxflx commented on Jul 19, 2018

    @flxflx
    Felix Schuster (flxflx)
    on Jul 19, 2018
    More actions

    I am getting the same error for the following line of code when I am on WSL or connected remotely to a Linux box over ssh.

    $nodes | foreach-object { start-job -ScriptBlock $function:createRemoteNode -ArgumentList ($_, ($nodeId++) + $constArgs)} | receive-job -Wait -AutoRemoveJob

  4. neel015 commented on Sep 13, 2018

    @neel015
    Neel (neel015)
    on Sep 13, 2018
    More actions

    Facing the same error when trying to run invoke-command using Powershell core 6.1 with Microsoft.Powershell.SDK dlls.
    Working on a linux ubuntu 16.04, I am able to run the command from powershelll core directly. However, when I try to run the same script from C#, I am getting the same error message.

    $TargetSession = New-PSSession -HostName $TargetComputerName -UserName $Username -KeyFilePath $KeyFilePath
    
    Invoke-Command -Session $TargetSession -ScriptBlock {
     get-process
    }
    
    Reacted by Dan Ports
  5. Steve Lee (SteveL-MSFT)
    self-assigned this
    on Nov 12, 2018
  6. JustinGrote commented on Jan 3, 2019

    @JustinGrote
    Justin Grote (JustinGrote)
    on Jan 3, 2019
    Contributor
    More actions

    This happens to me when doing SSH remoting from a Linux system to a Windows system via SSH if the commands are wrapped in jobs. Doesn't seem to matter if it's a process job or a runspace job.

    Works perfectly fine from Posh 6.1 on Windows to Windows via SSH

    Normal SSH Session (works)

    PS /tmp> $s = new-pssession -SSHTransport -HostName _REDACTED_ -KeyFilePath /tmp/tmpblvmbP.tmp -UserName _REDACTED_ -Verbose;sleep 1;icm -session $s -scriptblock {echo "test"}
    test

    Inside Process via Start-Job (fails)

    PS /tmp> start-job {$s = new-pssession -SSHTransport -HostName 172.30.2.89 -KeyFilePath /tmp/tmpblvmbP.tmp -UserName sa-awsmodelingstatus -Verbose;sleep 3;icm -session $s -scriptblock {echo "test"}} | receive-job -wait -AutoRemoveJob
    Windows Principal functionality is not supported on this platform.
    + CategoryInfo          : NotSpecified: (:) [Invoke-Command], PlatformNotSupport                           edException
    + FullyQualifiedErrorId : System.PlatformNotSupportedException,Microsoft.PowerSh                           ell.Commands.InvokeCommandCommand
    + PSComputerName        : localhost
    

    Inside Runspace via Start-Threadjob (fails)

    PS /tmp> start-threadjob {$s = new-pssession -SSHTransport -HostName _REDACTED_ -KeyFilePath /tmp/tmpblvmbP.tmp -UserName _REDACTED_-Verbose;sleep 1;icm -session $s -scriptblock {echo "test"}} | Receive-job -wait -AutoRemoveJob
    icm : Windows Principal functionality is not supported on this platform.
    At line:1 char:136
    + ... ingstatus -Verbose;sleep 3;icm -session $s -scriptblock {echo "test"}
    +                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Invoke-Command], PlatformNotSupportedException
    + FullyQualifiedErrorId : System.PlatformNotSupportedException,Microsoft.PowerShell.Commands.InvokeCommandCommand
    

    Steve Lee (@SteveL-MSFT) does your PR #8232 address this?
    EDIT: Just tested on 6.2.0-preview3 with #8232 included. It does not 👎

  7. JustinGrote commented on Jan 3, 2019

    @JustinGrote
    Justin Grote (JustinGrote)
    on Jan 3, 2019
    Contributor
    More actions

    Tried doing it with -SSHConnection and ran into #8589. SSH Remoting still feels pretty half-baked unfortunately...

  8. PaulHigin commented on Jan 5, 2019

    @PaulHigin
    Paul Higinbotham (PaulHigin)
    on Jan 5, 2019
    Contributor
    More actions

    Justin Grote (@JustinGrote) Unfortunately I am still unable to repro this error. But the error indicates that there is still some Windows code lurking in Linux code paths. I recently found and fixed a number of similar issues pertaining to Windows impersonation flow. The problem was found during remote debugging but it is possible it is related to your problem (#8451). However, the fix won't be available until the next release (I think Feb), unless you want to build your own version to test with. Also, if you can include the error stack trace, it may pinpoint the offending code path.

    Reacted by Àlex Corretgé
  9. danports commented on Mar 27, 2019

    @danports
    Dan Ports (danports)
    on Mar 27, 2019
    More actions

    I am working on a similar scenario as Neel (@neel015) and also ran into this issue on 6.1.3. Here's a stack trace Paul Higinbotham (@PaulHigin):

    System.PlatformNotSupportedException: Windows Principal functionality is not supported on this platform.
       at System.Security.Principal.WindowsIdentity.GetCurrent()
       at System.Management.Automation.RemoteDebugger.CheckForValidateState()
       at System.Management.Automation.RemoteDebugger.set_UnhandledBreakpointMode(UnhandledBreakpointProcessingMode value)
       at Microsoft.PowerShell.Commands.ExecutionCmdletHelper.ConfigureRunspaceDebugging(Runspace runspace)
       at Microsoft.PowerShell.Commands.ExecutionCmdletHelperRunspace.StartOperation()
       at System.Management.Automation.Remoting.ThrottleManager.StartOneOperationFromQueue()
       at System.Management.Automation.Remoting.ThrottleManager.StartOperationsFromQueue()
       at System.Management.Automation.Remoting.ThrottleManager.SubmitOperations(List`1 operations)
       at System.Management.Automation.PSInvokeExpressionSyncJob.StartOperations(List`1 operations)
       at Microsoft.PowerShell.Commands.InvokeCommandCommand.CreateAndRunSyncJob()
       at Microsoft.PowerShell.Commands.InvokeCommandCommand.ProcessRecord()
       at System.Management.Automation.Cmdlet.DoProcessRecord()
       at System.Management.Automation.CommandProcessor.ProcessRecord() at at <ScriptBlock>, <No file>: line 6
    
  10. danports commented on Mar 27, 2019

    @danports
    Dan Ports (danports)
    on Mar 27, 2019
    More actions

    Neel (@neel015) I was able to bypass the problematic code by calling RunspaceFactory.CreateRunspace(new WSManConnectionInfo {...}) to create a remote runspace rather than using New-PSSession and Invoke-Command, which feels cleaner anyhow.

  11. SteveL-MSFT commented on Mar 27, 2019

    @SteveL-MSFT
    Steve Lee (SteveL-MSFT)
    on Mar 27, 2019
    Member
    More actions

    Dan Ports (@danports) Thanks for the stack trace! With that, I see that Paul Higinbotham (@PaulHigin) made a change in #8451 that would have fixed this issue. That change would only be in PSCore6.2. Can you try 6.2-RC1 and see if you're original problem repros?

  12. Steve Lee (SteveL-MSFT)
    added
    Resolution-FixedThe issue is fixed.The issue is fixed.
    on Apr 3, 2019
  13. Steve Lee (SteveL-MSFT)
    closed this as completedon Apr 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @SteveL-MSFT
    Steve Lee (SteveL-MSFT)

Labels

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

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402520 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.