#28115·PowerShell

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

Author: jborean93Created Sep 28, 2026Updated Sep 28, 2026
LabelsNeeds-Triage

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:

powershell
# ${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

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

Actual behavior

bash
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

bash
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

powershell
All Powershell 7.x versions.

Visuals

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

https://github.com/user-attachments/assets/f47446f6-5293-48a5-8fa4-c62d0823df84

The same error occurs regardless of the transport protocol used.