OCGV: Does not seem to work in remote PSSession
See original GitHub issuePiping to Out-ConsoleGridView
after Enter-PSSession
produces an error and exits the PSSession. I have tried from Windows to MacOS and Windows to Ubuntu (WSL) using PowerShell 7.0.3 and Microsoft.PowerShell.ConsoleGuiTools 0.6.1.
PS C:\Users\admin> $session = New-PSSession -HostName computer -UserName admin
admin@computer's password:
PS C:\Users\admin> Enter-PSSession -Session $session
[admin@computer]: PS /home/admin> Get-Process | Out-ConsoleGridView
There is an error processing data from the background process. Error reported: 'exadecimal value 0x1B, is an invalid character. Line 1, position 1..
PS C:\Users\admin>
Is it caused by ESC in Dispose()
?
If it’s not supposed to work in PSSession then perhaps check for the existence of $PSSenderInfo
and handle it more gracefully without crashing out of the session.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Enter-PSSession : Connecting to Remote Server Failed
The error message means that your user account does not have access to create a remote PowerShell session from system A to system...
Read more >Enter-PSSession unable to remote into a remote desktop
Enter-PSSession unable to remote into a remote desktop · You must be using an account that is an admin on the remote host...
Read more >Mount DFS SMB share in remote PS session fails
5.142) and trying to mount a DFS share there (\10.44.5.143\dfs1\share1). It doesn't work correctly - I get error "A specified logon session does ......
Read more >Remotely use CMDlet that's not on the remote pc
1 Answer 1 ... You need to import the module using Import-Module using a PSSession on the remote computer. You can manage remote...
Read more >Mocking New-PSSession and Invoke-Command
So I'm testing a cmdlet that makes remote calls, but I don't want to actually make the remote calls in the test, so...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry about the confusion. My last commit will not make OCGV work over a remote session. It will fail with a terminating exception, but the remote session will not be closed. Only the last commit in the PR is needed.
I think for now, the cmdlet should check if it’s remote and fail gracefully. PowerShell remoting was designed to transport objects, so the text output for console rendering is confusing it.