Enter-PSSession - The method or operation is not implemented

Hello,

I try to display in a table the list of files present in a remote directory. I am using the openssh powershell module. Here is my code:

$MyDashboard = New-UDDashboard -Title “Hello, World” -Content {

New-UDTable -Title “Server Information” -Headers @(" ", " ") -Endpoint {
@{
‘Computer Name’ = env:COMPUTERNAME 'Operating System' = (Get-CimInstance -ClassName Win32_OperatingSystem).Caption 'Total Disk Space (C:)' = (Get-CimInstance -ClassName Win32_LogicalDisk -Filter "DeviceID='C:'").Size / 1GB | ForEach-Object { "([Math]::Round(_, 2)) GBs " } 'Free Disk Space (C:)' = (Get-CimInstance -ClassName Win32_LogicalDisk -Filter "DeviceID='C:'").FreeSpace / 1GB | ForEach-Object { "([Math]::Round($_, 2)) GBs " }
}.GetEnumerator() | Out-UDTableData -Property @(“Name”, “Value”)
}

New-UDTable -Title "C:\Script" -Headers @("Name", "Fullname", "Lastwritetime") -Endpoint {
 
$session = New-PSSession -HostName administrator@myipremote -KeyFilePath C:\ProgramData\ssh\authorized_keys
Enter-PSSession $session 
$a = get-childitem -Path "C:\test"
$a | Out-UDTableData -Property @("Name", "Fullname", "Lastwritetime")

}
}

Start-UDDashboard -Port 1000 -Dashboard $MyDashboard -AutoReload

On the dashboard : The method or operation is not implemented.

On a powershell windows, it’s working :

Can someone tell me what is wrong please

Solve the problem with this code :

New-UDTable -Title "C:\Script" -Headers @("Name", "Fullname", "Lastwritetime") -Endpoint {
 
$session = New-PSSession -HostName administrator@192.168.92.143 -KeyFilePath C:\ProgramData\ssh\authorized_keys


$a = Invoke-Command -Session $session -ScriptBlock { get-childitem "c:\test"}
$a | Out-UDTableData -Property @("Name", "Fullname", "Lastwritetime")

}

1 Like