Skip to content

Enter-PSSession - Clear-Host from non-Windows client to Windows target fails #28115

Description

Prerequisites

Steps to reproduce

When targeting a Windows host from a non-Windows host through Enter-PSSession calling Clear-Host fails. The Clear-Host implementation on a Windows target runs the following script:

# ${function:Clear-Host}

$RawUI = $Host.UI.RawUI
$RawUI.CursorPosition = @{X=0;Y=0}
$RawUI.SetBufferContents(
    @{Top = -1; Bottom = -1; Right = -1; Left = -1},
    @{Character = ' '; ForegroundColor = $rawui.ForegroundColor; BackgroundColor = $rawui.BackgroundColor})
# .Link
# https://go.microsoft.com/fwlink/?LinkID=2096480
# .ExternalHelp System.Management.Automation.dll-help.xml

Calling this in a remote PSSession will send the host method call back to the client which is fine with Windows client but a non-Windows client SetBufferContents for UNIX throws a NotImplementedException. The CursorPosition does still work but the contents are not cleared.

Expected behavior

The console is cleared and the cursor set back to position `0, 0`.

Actual behavior

The cursor position is set back to `0, 0`, `The method or operation is not implemented.` is displayed and original content is not cleared.

Error details

No explicit error for `Get-Error` as the exception isn't sent back to the remote session and just printed on the screen.

> The method or operation is not implemented.

Environment data

All Powershell 7.x versions.

Visuals

The below example shows what happens on a Linux client connecting to Windows.

Screen.Recording.2026-09-28.at.8.58.26.pm.mov

The same error occurs regardless of the transport protocol used.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-TriageThe issue is new and needs to be triaged by a work group.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions