Enter-PSSession - Clear-Host from non-Windows client to Windows target fails
Author: jborean93Created Sep 28, 2026Updated Sep 28, 2026
LabelsNeeds-Triage
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
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.xmlCalling 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.
https://github.com/user-attachments/assets/f47446f6-5293-48a5-8fa4-c62d0823df84
The same error occurs regardless of the transport protocol used.
Source: PowerShell/PowerShell